I've had this happen with colleagues or friends of friends.
Like there used to be a really attractive guy at my office. He was happily married, I am happily engaged, neither of us would ever cheat, but there was a flattering unspoken awareness between us that we both found each other attractive, BUT that we would never act on it. And we never said anything. Did it add a frisson of interest to my workday? For sure.
It also happened when I met one of my friends' boyfriend. Did either of us flirt or do anything inappropriate? No. But there was this sense of "yeah we're both not blind and we can see that the other person is attractive", and it's like a compliment. Doesn't cross any boundaries. It's in the microexpressions, body movements, intensity of attention etc.
On the other hand there was ANOTHER guy at my office who did indeed cross boundaries and make things very awkward. To the point that one time I knew if I was alone with him he would try and make a move. And he was married. The problem was, we had had that frisson and I had enjoyed his company before then, but then he started bringing up "I find it hard to control myself around you" and "my wife and I are technically polyamorous" (despite her not actually being poly) and I just was like welp. I didn't feel unsafe around him, but our friendship was definitely damaged and I avoided any of the kinds of interesting philosophical conversations we'd had before.