After my Google Pixel 5 upgraded to Android 12 it would only connect to my mobile phone service using 4G. 5G stopped working. After checking the network status I did some investigation and the only way to fix it was to reset the Network Settings. This causes the phone to reconnect to the phone network and set 5G as the preferred connection method.
Doing this deletes all WiFi networks, and all Bluetooth connections from the phone, so you will need to programme them all back in again. If you use Android Auto you will have to tell your car to forget the device and then delete your car from the Android Auto app on your phone.
To fix your 5G reset the Network Settings by going to:
Settings > System > Reset Options > Reset Wi-Fi, mobile & Bluetooth
You need to confirm the reset a couple of times then reboot the phone and it should connect to your phone network in 5G if 5G is available. If it isn’t it will connect via 4G but it will connect to 5G when there is coverage.