Yes, there is a globally unique ID called International Mobile Equipment Identity(IMEI) for each phone, and it cannot be changed (change is even illegal in some jurisdictions) It is often used for law enforcement and mass surveillance, when cell phones are connected to telecom operators' towers, the IMEI is a necessary condition when connecting.
But before iOS 5 (maybe iOS 4, I can't remember), any app on the phone could get the IMEI, so Apple banned apps from the app store from getting the IMEI in a later iOS update, which was around 2012 year thing.
This is very late compared to Android. Before Android 10 (2019), any app could obtain IMEI by requesting "phone" permission. Google finally fixed this long-standing privacy hole in Android 10.
But today, the IMEI is printed on the phone's box, on the laser engraving of the phone body, on the phone's settings page, and although unprivileged apps from the app store can't get that information today, you can't hide or change that information, except by putting the phone in airplane mode, otherwise it will always be shared with the operator, even if you change the SIM card and phone number, the operator will still know the phone.
en.wikipedia.org