Either the software isn't seeing the proximity sensor or your hardware needs a repair.
I have had good luck testing the phone immediately after a normal reboot (slide to power off and letting it shut down) Then place the phone flat on the table, press sleep/wake to power it on and once it starts - just call 611 or another free call before starting any apps. Place your whole hand over the top half of the glass and play with the sensor that is near the receiver / front camera to see that the screen goes on and off as designed.
Restoring the phone (and sometimes setting up as new) is needed to reset the software when it fails. Calling or going to an apple store for assistance or repair is the next step once you've decided it's not fixable from simple software.