finding distance y between two objects?

i use something like this to generally find the distance between two objects but how can
i find only the y distance??

public float distance;
public Transform target;

......
.
.
.



distance =Vector3.Distance(transform.position,target.position);
Transform A = something
Transform B = somethingElse

Distance = Mathf.abs( A.position.y - B.position.y )

you mean Mathf.Abs…
haha i spent 20 minutes trying to understand what is wrong!
thank you very much mate!!