After updating my device to pie, I noticed that the proximity sensor is always active when the screen is on (one can see a fait red dot near the ear piece when it is active). I didn't observe it before the update. Please reply if anyone else have the same issue.
If you turn off the adaptive brightness it will be not not be always active. Due to I was having more battery drainage in comparison to Oreo. To check whether proximity sensor is working or not see it with the camera of other phone.
Turning off the adaptive brightness is not an option because it is really useful. I think android pie's new adaptive brightness uses proximity sensor. Well, that is a terrible excuse for google and it is one of the reasons for faster battery drain.
I guess the new android is adapting itself to the phone and users usage as I too had the same issue and today all of a sudden the proximity sensor started working very fine. I guess we must wait for some time