Normally mobile phones have a dynamic IP address issued every time they connect to the network due to the mobile carrier have a NAT firewall as part of the connection.
One way around this is to use a dynamic IP service such as dynu.com (others do exist) and refresh the data each time it changes.
The better way is to talk to your carrier or a third party specialist such as Nucleus (again others can provide this) for a fixed IP Sim. These are often used in fuel and remote camera management (quiet well from past experience) but can be more expensive than normal SIMs to run and are often data only.
I have not seen a 5G offering (I am in the UK) or an offering for a static IPv6 address yet BUT due to location I was restricted to carriers that did not offer either IPv6 or 5G services!
The third way - not always possible in applications is to set up the network where the Pi pushes data out to, and reads instructions from, a static site.
Out of the three - I would go with the dynamic IP addressing unless the device changes IP very frequently as low TTL entries on DNS can cause update issues.