Check out example codes for "how to compare distance between 2 objects unity". It will help you in understanding the concepts better.

Code Example 1

float distance = Vector3.Distance (object1.transform.position, object2.transform.position);

Learn ReactJs, React Native from akashmittal.com