You can't turn off the proximity sensor on your iPhone, but if it's malfunctioning, try force-restarting your iPhone and ...
[mircemk] shows how to create a simple non-contact proximity sensor using little more than an Arduino Nano board, and a convenient software library intended to measure the value of capacitors. The ...