Hi
Apple's tips for maximising battery performance and battery life on iPhone are available here:
https://www.apple.com/batteries/maximizing-performance/
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 advises 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: