Here’s the SRD entry for the spell. It definitely nukes the neutrals.
Which is kind of horrifying because most of the population of any given setting is supposed to be neutral. The average commoner isn’t so greatly committed to following airtight moral codes that they’ll ping on a detect whatever spell, whether that’s good, evil, law, or chaos. Cast that on a crowd of randoms and you’ve probably wiped out three quarters of them.
It was a bit different back in the 3rd edition days, “good” and “evil” were slung around a bit more liberally. I believe it wasn’t until the 5th edition when they introduced the “unaligned” state, which is sort of “neutral but without the commitment”, and assumed most average folk were unaligned.
Presumably before the high cleric casts Holy Word there’d be a festival ahead of time in which people are given plenty of opportunity to donate to good causes (ie, the Church) to crank up their good meters before being “tested.”
I feel like the average townsperson would sit between neutral good/lawful neutral.
Implementing a system like that would kill a lot of innocent people and the occasional guilty person.