XR ray gets shortened when interacting with UI

,

i have a hand menu ui in my game and i am interacting it with using xr ray. but for some reaons why i am on moving ship xr ray gets shortened and then i am unable to interact with UI.