Distance to a satellite is determined by measuring how long a radio signal takes to reach us from that satellite. To make the measurement we assume that both the satellite and our receiver are generating the same pseudo-random codes at exactly the same time. By comparing how late the satellite's pseudo-random code appears compared to our receiver's code, we determine how long it took to reach us. Multiply that travel time by the speed of light and you've got distance. To measure travel time, GPS needs very accurate timing which it achieves with some tricks.
Accurate timing is the key to measuring distance to satellites.
Satellites are accurate because they have atomic clocks on board. Receiver clocks don't have to be too accurate because an extra satellite range measurement can remove errors. Along with distance, you need to know exactly where the satellites are in space. High orbits and careful monitoring are the secret. To use the satellites as references for range measurements we need to know exactly where they are.