iPhone 5 (iOS 10.3.3) getting pretty hot within brief usage of 5-10 minutes
While there could be a variety of reasons for an iPhone to warm up, the common ones include using it while it's charging, using a bad (cheap, 3rd party) charger, bad battery (can be ruled out as you mentioned you got the battery replaced), one or the other component failure due to ageing (iPhone 5 was released in 2012 and were last produced in 2013 before being discontinued), using a rouge app (a non-performant app which may cause device heat up on slower devices, usually happens with some 3rd party apps and certain resource intensive games) etc.

Luckily, you iPhone has a built-in heat sensor and if it gets warm beyond a point, it will show a warning sign and shut down automatically. So, while heat up could be a concern, there should be no real threat of serious damage (again, it is preferable to use Apple original charging equipment).

While there could be no concrete answer for the issue, I'd experiment with tweaking with various parameters mentioned above.