First check if Cellular/Mobile Data is activated here:
Settings → Cellular → Cellular Data must be enabled.
If your iPhone does not switch to 4G, also check whether your iPhone is connected to your carrier.
Pull down the Control Center and see if you have Signal Bars and if your Carrier name is visible. If it says, for example, No Signal or SOS Only, restart your iPhone and remember to enter your PIN code so that your SIM card can connect to the network.
If you use eSIM, check if it is activated:
Settings → Cellular → Turn On This Line must be activated if eSIM is your primary SIM card.
Remember, if you have got a new SIM card, it must be activated by your carrier. If you continue to experience problems, contact your Carrier, as they are responsible for Mobile Data.