I'd say that the big issue with Detect Evil as a spell/ability is that in practice its real function, in game terms, is to detect danger -- i.e. it's a way for players to find out if an NPC/creature with whom they're interacting poses a risk if you turn your back on them. It's in the extremely natural and subtle jump to the conclusion that "Evil" means "dangerous" where the interesting ambiguities lie, or that "not Evil" means "not dangerous".
The idea that being Evil-aligned -- which, for non-supernatural sapient beings, I'll define briefly as, "willing, and habitually prone, to personally and actively hurt other sapient beings for a purely selfish benefit without feeling any serious remorse" -- is necessarily a danger to specific PCs in specific contexts is, of course, not a given. One of my favourite red herrings in fantasy murder mysteries is to make sure that the murderer is not the NPC who Detects as Evil, although that NPC may well play a vital role in the mystery in another way.
Another ambiguity I'd include would be to rule that even a Good or Neutral NPC, if seriously thinking about taking an action that would change his alignment (for even Good people can seriously consider doing appalling things in exigent circumstances), can temporarily Detect as Evil if scanned right at that moment. This is another way that PCs becoming over-reliant on the spell can trick themselves. Alternately, a character can be a thoroughly malicious a-hole who leaves a trail of wrecked lives behind him without ever actually being violent or dangerous to the average PC: again, Evil, but not a threat, or even necessarily a criminal.
Certainly one of the ways I would play any serious, conscientious social or religious scheme of Good is that its fundamental desire is to redeem or prevent Evil in ordinary people, not just stamp it out wherever found, so only particularly stifling or self-righteous theocracies would treat merely detecting as Evil to be a crime in itself if no actual lawbreaking actions can be proven to go with it.