You can't turn off the proximity sensor on your iPhone, but if it's malfunctioning, try force-restarting your iPhone and ...
Revive your unresponsive iPhone by forcing it to restart. Additionally, you can try charging the phone or reinstalling iOS.