Your phone records the signal arrival time and uses it to calculate the distance to the satellite using the simple formula, distance = c x time, where c is the speed of light and time is how long the signal traveled.