This sounds weird but there is no (easy) mean to obtain the same distance as when you point with a rangeFinder.
I tried to obtain any distance with:
_cursor_distance = if (isnull cursorTarget) then [{player distance (positionCameraToWorld [0,0,player distance screenToWorld [0.5,0.5]])},{player distance cursorTarget}];
But this method fails in lot of cases because cursortarget returns the bounding center of the object and we need the point of "contact" (aimed point). On the other hand, without cursortarget, distance with screenToWorld command can't see objects and returns ground.
So, i never found a way to pick up distances like in a rangefinder. Big houses, wall will return one global distance instead of acctual aiming point(s) distance(s).