Had the exact same issue with my Nothing Phone 2A. Found out it was because of a double screen protector.
The phone comes with a thin screen protector already applied, but at the store they put another screen protector on. It was interfering with the touch sensor and the gestures would not work when the phone was not in my hands.
Accidentally found out about it and immediately took both of the screen protectors off. I placed a single screen protector on and now the phone works great.