Hello SRoyPC,
We understand that during certain situations the screen on your device does not dim or light up as expected and could possibly be due to the proximity sensor. We'd be happy to help.
Do you have a case or any front screen protectors? Remove them if possible and test to see if the device works as expected. It is possible that a case or protector may be obstructing a sensor on the device.
We would also suggest restarting your device and checking for any available iOS updates. If you have an available update, backup and Update your iPhone, iPad, or iPod touch.
If the issue continues, we would recommend reaching out to Apple Support as a next step or schedule a service appointment for your device, here's some information on iPhone Repair and Service.
Have a nice day.