how is depth measured with photons?
Depends what exact context you’re thinking of. First, let me mention that light always travels at almost exactly the same speed when in air or space, and that is relevant for two of these.
In astronomy, photons lose energy as they travel billions of years and we can measure the distance they travel based on their speed and how much energy they lose.
In day to day life, photons coming from the same spot will hit our two eyes at different angles. We can measure the difference in the angles and use it to gauge distance. At that point it’s simple trigonometry.
Lastly, we can fire light at an object and wait for it to bounce back. For this, all you need is a really good timer. The time it took to travel can be converted to distance with a bit of multiplication.