Your GPS cannot directly determine the distance from any satellite, it has to go indirectly. It gets a signal from the first satellite, say "it was exactly 10:30:25.123456789 seconds according to my extremely precise clock when this signal was sent", and it gets a signal from the second satellite, say "it was exactly 10:30:25.123556789 seconds according to my extremely precise clock when this signal was sent". The clocks are 0.0001 seconds apart. So the signal from the first satellite travelled 0.0001 seconds longer. At 299,792,458 meter/sec, that is 29,979.2458 meters difference. So you are 29,979 meters closer to the second satellite than to the first. And your GPS also knows the exact location of the satellites.
With the third satellite, you also learn how much closer or further away you are to the third satellite compared to the first and the second. You can turn that into three rather complicated equations, and try to solve those equations, but there is not just one solution: There is a whole curve of solutions.
Now if three satellites is all you've got, your GPS can make a guess: It guesses that you are located on the surface of the earth. Your GPS has likely a map of roads in your area, but it also has a map of elevations. So it guesses first that you are at height zero and calculates where that curve intersects with the earth surface at height zero. That might be off a bit because you are in a hilly area, 1000 meters above sea level. But the GPS knows your approximate location, so it guesses you are about 1,000 meters above sea level, recalculates where you are, and that location might be 980 meters above sea level, and then the next calculation gives you your precise location. But only if you are on the surface. If you are at the top of a church tower, your location will be guessed wrong. If you are on an airplane, with a window seat so your GPS gets a signal, it will be quite imprecise, maybe kilometres off if you are 10,000 meters above ground.
With a fourth satellite, there are four ways to take three satellites and calculate the curve where you should be, so you get four curves. And then the GPS picks the point that it is closest to all four curves. That gives you your location quite precisely, and at the same time, if the curves don't meet exactly in one point but are maybe ten meters apart, then you also know the precision of your location.
(Some smartphones nowadays have a barometer. That could also be used to estimate your height above sea level, not very precise, because air pressure also depends on the weather, and help you get your location if you are high above ground. I don't think anyone does that. )
If you had a very precise atomic clock, you'd need only three satellites. But atomic clocks are big and expensive, so there isn't one in your mobile phone.
PS. If you think that it's kind of unfair that you need four satellites to get three coordinates, you are actually getting four. You also get the time with very high precision (maybe 100ns). Annoyingly no phone that I have seen uses this ability to set its clock. Actually, just a single satellite gives you the time with less than 100ms error: The fact alone that you can receive the satellite gives you your location with a ridiculous error of thousands and thousands of miles - but if you divide this error by the speed of light, then you get a better approximation for the time than your wristwatch will give you.
PPS. With four satellites your position is already overspecified. There are four curves, and with infinite precision they would intersect exactly at the point where the GPS is. But we don't have infinite precision, so we take the point that is closest to them. Five or six satellites would work exactly the same, except you have more curves.