I’m not sure why you think it’s the sound itself rather than the word/meaning.
“Fag” the British slang vs “fag” the American one.
—
I should also note — I fear the pedantry is warranted — that words have not only literal meanings but equally important connotation.
For example, racial slurs refer literally to the race, but also connotate a certain emotion/perspective.
If you're objecting to the very presence of the word then you're objecting to the word itself rather than the meaning being conveyed. There's a huge difference between e.g. describing a slur versus directing it at an individual, and just counting the number of times the slur is written obliterates that distinction.
If I were to point to some misbehaving members of some group today and say they were "naughty", this would not induce the same experience as it would have in Shakespeare's time, where that word meant "worthless". One can object to the latter and not the former, precisely because which word pulls the metaphorical lever on which mental experience, changes between those situations.
The question "is moderating such language is a good idea or not?" is a separate one to this.
One can - but not by just grepping for the character string and plotting a graph of the counts.
Citing that as a counterexample is weak.
Disagree. The fact that voluntary communication works is somewhat miraculous, sure. But the idea that a reader could be made to experience something unpleasant against their will by mere words is far stranger. Obviously unpleasant meanings can be conveyed through words, but the idea that the words themselves can be inherently unpleasant feels like some kind of moral panic/social contagion (like if there was a satanic panic centered on the "brown note") rather than a real thing.