Hi
Apple advises that it can be normal for your iPhone to become warm in certain situations, including when charging it, when you first set it up, when you restore it from a backup and when apps re-index or re-analyse data (such as Photos tagging for faces, places, or keywords after a software update).
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: