How to estimate real distance between two detected objects in an image?
Distance in an image is based on pixels. You will need to convert this distance to the actual real world metric like cm or inch. To make this happen, you will also need a reference object in your image whose real world dimensions are already known to you. Or you will need the distance between the object and camera. If you manage to get this distance using your camera lens, then you won't need any reference object. And then, it is very complex to get distances between objects placed in 3D space.
This is a great article that explains the aforementioned approaches in 2D space. It might be a good start for you.