I'd say making an obvious analogy is being less in-your-face than transplanting one of today's problems onto the Federation's future society. The layer of fiction is what makes it effective IMO.
Nobody will feel called out by the ridiculously hate-filled half-black half-white aliens, but if one group was black and the other was white it would be a different story. Making them green and purple would also be less effective because people could just map those to human skin tones. That, I think, is what people would find in-your-face. Doing it the way they did on TOS (aliens of the week that literally look the same except mirrored, no clear good/bad side - it's racism, but not as we know it) puts the ridiculousness of the concept itself front and center, not how the story could be a direct translation of our current issues. And it allows the protagonists to react accordingly as well.
The black-and-white aliens aren't a subtle analogy but I think it's smarter than people give it credit for.
As in, one way is within the story, keeping the Federation utopian (as you'd expect when you watch a Star Trek show), the other not so much. But I'm mostly talking about Picard here, don't remember too much about Discovery to be honest.