Debatable. I don’t really think the thing is about what people deserve. A sword like that could be used for all kinds of different things, not just some moral crusade.
Hell, I’d use it to detect so-called good people without the stabbing and avoid them. The worst kind of people are good ones. Goodness itself is a kind of evil.
People are quibbling over what is good and evil but no one considers how useful a sword like that would be. D&D already has a hard-coded alignment system with predictable behaviors associated with each alignment so implying good and evil are subjective is meaningless.
Then again, morality itself is pretty meaningless so 🤷
I can’t speak for the mechanics of any game you’ve played as the GM can change these things, but most people don’t treat Good and Evil as being so simple. Most games I’ve been in treat evil as varying degrees of selfishness while good is selflessness. The landlord that mercilessly squeezes the tenants for an extra nickel would probably be evil, maybe not as evil as a vampire who kills to sustain their immortality, but still evil. Just because someone is evil doesn’t mean they deserve death, we don’t execute thieves in the real world.
A magic weapon or spell that can only harm evil people doesn’t mean that you can nonchalantly use it. If you used holy word in the middle of a crowd and killed 30 people who were just shitty people you’d be evil as well. The same goes for using the sword, if you go around stabbing people to see if they are evil it would make you evil.
Not sure how you’d use the sword to detect evil people without the stabbing part, what are you gonna do, tap them with the pommel and see if they felt anything?