You can't turn off the proximity sensor on your iPhone, but if it's malfunctioning, try force-restarting your iPhone and ...
If your iPhone's sensors aren't working correctly, you may need to calibrate them. Here's how to calibrate an iPhone's brightness and motion sensors.