How to calcualte distance to position(udim2.new)

So in my case i have a plate that starts at the pos (in 3D space) 0,0,-23 and ends at 0,0,-173
but the position of a gui is 0-1 so -98 would be equal to 0.5 and the gui would be in the middle of the screen and -23 would make the gui on the left side completely and -173 would make the gui be to the right completely

NOTE: The position is the characters Z position so his Z position would be -23 to -173

I’m not sure which is the one but you can use Camera:WorldToViewportPoint or Camera:ScreenPointToRay.