In respect of your iPhone's temperature, Apple advises that it can be normal for your iPhone to become warm when using it and also in other situations including when charging it, first setting it up, restoring from a backup and when apps re-index or re-analyse data (such as when Photos performs background tasks after a software update).
The exterior acts as a cooling surface, transferring heat from inside the iPhone to cooler air outside.
Apple also notes that charging your iPhone when it is inside certain styles of case may generate excess heat, which can affect battery capacity. If you notice that your iPhone gets hot when you charge it, Apple advises that you should remove it from its case before charging.
Be sure to follow all of Apple's safety and handling guidelines, including those detailed here:
- Keeping iPhone, iPad, and iPod touch within acceptable operating temperatures - Apple Support
- http://help.apple.com/iphone/10/#/iphbbe12ba1
- https://www.apple.com/batteries/maximizing-performance/
If you are concerned that your iPhone gets warmer than it should do, I suggest that you contact Apple Support or visit a Genius Bar or Apple Authorised Service Provider with a view to having your iPhone checked and, if recommended, serviced: