All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
Allah, The Exalted, commanded the believers to lower their gaze. He Says (what means): {Tell the believing men to reduce [some] of their vision.} [Quran 24:30]
If a Muslim man unintentionally glanced at a non-Mahram woman, he is not sinful for that, but it is incumbent on him to avert his gaze and look away. It was narrated on the authority of Jareer ibn ‘Abdullah that he said: “I asked the Messenger of Allah, sallallaahu ‘alayhi wa sallam, about the unintentional glance, so he commanded me to avert my gaze.” [Muslim]
If you lower your sight from what is prohibited and avert your gaze and look away but you still notice a woman’s presence next to you without seeing any part of her body; rather, you only notice that there is someone next to you, then there is nothing wrong with it and you bear no sin for it.
Allah Knows best.