Here's a good breakdown on nasal sprays for covid, and other viruses for that matter.

All of these sprays work by forming a protective barrier in your nasal cavity that blocks viruses from binding with the ACE-2 receptors. Most research agrees that your nose serves as the primary gateway for infections.

It's the landing ground.

From there, you aspirate viral particles into your lungs. If you can block, deactivate, or kill pathogens in your nose, then you prevent an infection before it gets going.

The rest of the article goes into how they work and what we know about how effective they are.

I wouldn't trust them that much in crowded indoor public space, but if you are hanging out with friends and none of them are symptomatic of anything it certainly helps lower your risk.