If your phone gets warm it is using the processor very heavily. This usually happens when running games or some app which is very work intensive (turn-by-turn navigation) for long periods. When the phone gets warm, your battery life will be shorter because a lot of battery power is being used.
If you are not running these apps, there is some process which is out of control. First, restart your phone:
Hold down the Sleep/Wake switch on the top of the phone until you see the red arrow on the screen. Swipe the arrow to power down the phone. After the phone is powered off (completely black screen with no spinning icon), please hold down the Sleep/Wake switch again until you see the Apple logo.
If the overheating continues, plug your phone into iTunes and do a Backup and Restore. If that does not solve it, you will need to contact Apple.
Your phone should not get hot with normal use.