The word you're trying not to use is the Other. Yes, these creatures are historically the foe, villain, monster, outsider, and other. That's exactly the problem. They're incredibly thinly veiled racist stereotypes and have been for decades. Yes, even when Uncle Tolkien used them. Just because you're used to them, you like using them, or they're convenient shorthand for you does not make them less racist. That they're only ever used as the foe, villain, monster, outsider, and other is part of the problem. That they're the default evil is part of the problem.
Their function can be the same as any other character in fiction. Serving any one of an infinite possibilities. You don't have to use racist tropes to have a foe, a villain, or a monster. A well-dressed human will do. A cannibal dwarf is just as good as an orc. You don't have to use racist tropes to reinforce in groups and out groups. Breaking bread with people of shared interest will do as will defending against a common enemy. Now just imagine the common enemy is a human and you're standing next to an orc defending your village.
Look at Game of Thrones. Nearly 100% human characters and plenty of villains. Plenty of anti-heroes. Plenty of violence and intrigue. No need for racist tropes. But you don't need to go 100% human. You can still use orcs, trolls, goblins, gnolls, bugbears, etc. Modern gamers are simply pushing back against the obvious racism dripping from these creatures. You can have a chaotic tribe of humans as the villains. You can have an orc wizard as the villain. You can have a goblin artificer as the foe. A gnoll scholar as the quest giver. A bugbear detective. A troll gardener. You don't have to only use non-human creatures as villains.
Likewise you don't have to use humans, elves, dwarfs, and halflings as the good guys. At a guess you don't have trouble making any of those into foes, villains, monsters, outsiders, or other. It's simple. There is no default for those races, they can be anything. Good, bad, or in-between. So why is it so difficult to see orcs, goblins, ogres, or trolls as anything but the monster? Why is it so hard to let them be neutral or good? Not in a morally relativistic flip the meaning of good and evil on its head sense. But in a straightforward sense. Why not a LG troll paladin? Why not a goblin scribe who serves the good king of the human lands? Why not a gnoll shipwright building the best barges in the land.
Why do orcs, goblins, trolls, etc have to be evil? Tradition is about the worst excuse possible.