Rainbows are formed from the millions of individual raindrops that happen to be in exactly the right place at the right time, so it is difficult to be precise about how far away a rainbow is.
Because a rainbow is a trick of the light rather than a solid materialobject set in the landscape it has no fixed position and is at no fixed distance from an observer. Instead, rainbows move as the Sun and the observer move or as curtains of rain cross the landscape.
Because a rainbow is composed of light reflecting off and refracting in millions of individual raindrops it might be fair to say that the distance to a rainbow is the distance to the location of the greatest concentration of raindrops diverting photons towards an observer.
An observer cannot easily estimate the distance to a raindrop or a curtain of rain along their line of sight but the position of clouds or objects in the landscape can help to determine where rain is falling.
The position of a rainbow is primarily determined by angles. The angles are constants and result from the physical properties of light and water droplets, not least the laws of reflection and refraction.
As an observer moves, the rainbow they see moves with them and the angles are preserved.
Size of a rainbow
Just as the visual impression of the size of the moon depends on how near it is to the horizon, the apparent diameter of a rainbow is also affected by other features in the landscape.
Duration of a rainbow
A rainbow may be visible for minutes on end before receding slowly into the distance. In other situations, a rainbow may appear one moment and be gone the next.