Let’s define “overheating”. If an iPhone overheats it shuts down so it can’t be used, and displays a message saying it must cool down before it can be turned on, and it will probably be unusable for an hour or so. If you are seeing this it is a hardware problem and you should contact Apple support:
Note that both of the above have options to receive a callback or chat
If you are not seeing this your phone has not overheated. However, if you fast charge your phone may get very warm, and may pause charging at 80% and display a message saying that charging has paused, and will resume when the phone cools down. This is NOT overheating, and is normal when fast charging. It also won’t prevent you from using any app you have on your phone.
Also, some apps that use a lot of energy or that use cellular data rather than Wi-Fi can cause the phone to run warmer. The camera, in particular, uses a huge amount of energy when it is open; CMOS sensors are power hungry, and your new iPhone has four, and three of them that can be on at the same time.
In addition, after the iPhone is set up it has a lot of “housekeeping” that it needs to do, building the search database, reorganizing other databases (photos in particular) and general setup. So you can’t judge energy use in the first hour after you have set up the phone. Give it several days to finish setup.