The easiest way to get the distance between two vectors if you want to ignore height (or an other dimension) is
var a : Vector3;
var b : Vector3;
function Start()
{
print( "ignoring height, the distance between a and b is "
Vector3( a.x-b.x, 0, a.z-b.z ).magnitude );
}