The following code should display the distance between the origin and the impact point, but instead it shows the length of the ray minus the actual distance.
RaycastHit2D hit = Physics2D.Raycast( transform.position, -Vector2.up, 10.0F );
Debug.Log(hit.distance);
I ran into a very similar problem and finally discovered that Raycast2D appears to be sensitive to the Transform scale in which you are running it. In my case, a parent object was set to Scale 0.5, making my collision detection appear to happen at half the distance it should.
At least something to check if you’re facing similar issues.