How else can you respond, other than saying "the code seems to be correct, and there's not enough to reproduce the problem here. can you provide more information?"
The difference between your phrasing, and a blunt "works for me" is that you actually bother to inquire further and don't desire to just shut things down so you can move on to the next question and make more points.
Often the real problem for novices is that they don't know enough to ask the right question; good questions require that you already be pretty close to the answer. So the real process of helping somebody with technology often begins by turning a bad question into a good question.
So basically, I think "works for me" is disrespectful. Mostly I see it used defensively; the goal is to make the querent go away again. If somebody doesn't want to help, fine, I respect that. But in that case, they should not put themselves into a position where they are answering questions from novices.
What a bizarre interpretation. When someone says, "It works for me," they're saying "I tried your example because I want to help, but was unable to reproduce your problem. Maybe there's some information you didn't provide that can explain the difference between what I'm seeing and what you're seeing? Please add more information so I can understand what's different and help you."
I was tempted to qualify this more, but honestly, if you can't see why "works for me" is one of the worst kinds of answers you can give in tech, then i doubt i can convince you.