This is actually a simple ratio problem you can solve easily with a basic calculator
.
We can a trace light ray coming from the top of the object to the lens. We can a trace light ray coming from the bottom of the object to the lens. These traces describe a triangle. The base of this triangle is a trace from the center of the object to the center of the lens. This is called the object triangle.
Light waves travel through the lens and fan out tracing out a triangle called the image triangle. The two triangles are the same as to their angles thus the length of the sides and the base trace out similar triangles, all the angles are the same however the lengths and base are not the same but they have the same ratio.
Given your description you know two things about the image triangle. You know its height; this will be the focal length of the taking lens. You also known the length of its base; this is a measurement taken from the imaging chip’s height or width. Say the focal length is 6mm and the chips, height is 10mm. We can divide these values and find a ratio. Thus 10 ÷ 6 = 1.66. This is the ratio height to base.
From your description we known height of the object. The distance to the object is unknown. Since the object triangle and the image triangle are similar we can use the ratio we have just calculated to find the distance to the object.
Say the height of the object is 14 feet. The distance to the object will be this object will be 14 X 1.66 = 23.24 feet.