We know from observations that light moves at a constant speed, even when the observer is moving near the speed of light, and we know that this observation is true regardless of your frame of reference.
In order for physics to remain consistent while accounting for the constant speed of light, other things need to flex between the two reference frames: namely, time (time dilation) and length (Lorentz contraction).
While in the same medium, right?
The speed of light is a universal constant in a vacuum, like the vacuum of space. However, light can* slow down slightly when it passes through an absorbing medium, like water (225,000 kilometers per second = 140,000 miles per second) or glass (200,000 kilometers per second = 124,000 miles per second).*
https://www.space.com/15830-light-speed.html#section-speed-o...
For example, the speed of light in a medium is not the "speed limit" of things in the same medium, and particles in it can actually move faster than light: https://en.wikipedia.org/wiki/Cherenkov_radiation
In other words, the speed of light in vacuum plays a special role in both a vacuum and a medium.
But a century of experimental and observational data proves that it is.
At this point it's generally just taken as a fact that the speed of light is constant for all observers. The explanation given above falls out as a direct mathematical consequence.