Being in any long-term relationship doesn't mean you won't be attracted to other people, and we shouldn't expect this of ourselves. To me flirting - playing along with what is an obvious mutual attraction - is part of this, and can be safe, boundaried and fun, as long as both people are clear about what it is, and isn't.
That's a difficult balancing act and may require spelling out where the boundaries are. It sounds like you may have hit that point with your workmate. It's probably going to be necessary to talk to him, and spell out that you like him, enjoy his company and acknowledge the chemistry between you while making it clear you won't be acting on that.
It doesn't have to be weird, with that acknowledged you can still enjoy each others company, as long as he gets the limits.
Now, to your marriage. Often these kinds of experiences point us towards something that might be missing in our long-term relationships. All relationships wax and wane, in terms of our feelings and the intensity of them, the desire, sexual attraction and excitement. That's all perfectly normal.
I'd encourage you to see these recent events as pointing you towards what you want and are likely feeling that you aren't getting enough of in your marriage.
Your work now is to reflect on what that is. It might be the feeling of someone being obviously attracted to you, the excitement of something new, or the feeling of getting positive attention. Either way, it's okay to notice that, and absolutely okay to want more of it.
The task then is to set about creating more of what you want - in your marriage. And of course, you can't do that on your own, and yes that is going to require a conversation - although how much you say about your work colleague is up to you, and needs to be informed by how much you know about your husband's ability to understand, without getting derailed by jealousy.
The point is, you haven't done anything wrong, you had some feelings, and turning towards your long-term partner is the "right" course of action.
So talk with him about what you need, and take co-responsibility for creating it. Think about some ways to make more time and space for your relationship, how to add novelty and excitement to your sex life and talk about your need to feel noticed and attractive - by him.
These are all legitimate needs, and approached gently and positively - avoid blaming and criticism - then hopefully your partner is willing to jump on board.
Worst case, if he isn't able to hear you, or isn't able to take co-responsibility for the relationship in this way, then I'd encourage you to consider couples counselling to help the two of you have this conversation and work deliberately on building the kind of relationship that is going to last.