For the type of digital transmission used by the cellular networks, the path delay (time it takes for the radio signal to get from you to the tower) must be compensated so all signals from the various phones arrive in their correct slot. This also means the network has a good idea of how far away from each tower you are. From there it is easy to triangulate your position. This is phone independent. I assume 5G due to the higher data rates needs the time compensation to be even more precise giving even better position estimates.
Note also that if your phone has bluetooth on, it is possible to find your position using that. Some stores do this to track your position inside the store, work out what things you are looking at, send you targeted advertising and so on. WiFi is less of an issue unless your WiFi is radiating a signal (hotspot, discoverable).
If you don’t want to be tracked, the only solution is not to have a phone.