A double rainbow seen from Asheville, North Carolina.
Credit: Grant W. Goodge/NOAA
You'll never swim out to the horizon , and you'll never reach a rainbow's end. The visibility of both requires distance between object and observer.
Rainbows consist of water droplets being struck by sunlight in a certain way. Round, transparent drops of water refract and internally reflect some sunlight towards the observer. Different wavelengths of light refract (change angles) at different angles, so the white light of the sun is parsed into an orderly band of colors.
A high density of waves emerges traveling in the direction of least deviation from the entry angle, and it is these waves that create the rainbow.
As these insubstantial pageants are but light and water, don’t go searching for the touchdown spot. The optical phenomenon depends upon you being situated a distance from the droplets, with the sun at your back.