iPhone switches to speakerphone when away from my face
When you lay your phone on the table and dial a number, you should see this screen.



If you see speaker in blue, you might try tapping that part of the screen to see if you can return to the receiver for sound out. If so, hang up and repeat the call.

If all calls start with speaker, then you have a problem with the software or hardware. The Apple troubleshooting web site might help, but I'd do this first:


Power down the phone and test after a clean restart. 
Back up the device (you will need to restore your data to the device after resetting things other than the settings in the immediate step below)
Go to the Settings app > General > Reset > Reset All Settings
Repeat the dial on the table test
Now erase everything on the phone Settings app > General > Reset > Erase All Content and Settings
Repeat the dial on the table test
Restore the device using iTunes to erase it.
Check the headset port and dock connector for foreign debris (or liquid damage)
Get the hardware serviced by Apple (or other service provider) by going through the Apple Troubleshooting website mentioned before this list.