How to measure distance between two moving objects?
Sound is a relatively easy phenomena to use to measure distances because it is quite slow. 

There are many answers which you could find on this site, e.g Why sound wave is the best choice for many location detectors?

This explains some  of the issues around using electromagnetic radiation High precision trilateration in a small space and without ultrasound