Distance of a people in an image
Updated: Measuring distance from camera to object

Perhaps you could search and find tons of materials. This is a well-established task, for example this tutorial, of more advanced methods combining object detection with distance measurements, see Object-Detection-and-Distance-Measurement, and references at the bottom. In a nutshell, when you know details about your camera focal length and the details about the object in the image, it is a simple formula to estimate the distance base on those details. I am guessing that you may need to do some calibration, but I haven't done this one myself, so I wouldn't know for sure. 



Earlier I have had: Measuring distance between objects

One idea that might be worth exploring is to segment your image, for example use the recent package by Facebook Detectron2, that seems to be capable of segmenting people out-of-the-box. Once segmented (filtered only for humans), for each segmentation calculate the center of segment (Centroid) or something similar assigned to each person. And given that would be (x,y) coordinate, you can easily calculate distance from a person to all neighboring people. 

For the center of segment , OpenCV is quite handy. See this post Find the Center of a Blob (Centroid)! Or this great tutorial to estimate distance between objects in an image with OpenCV!

In a nutshell: Image Segmentation -> Centroid -> Distance