One of the greatest strengths of fiction is that it can show us things beyond what we would normally see: fictional worlds, events, cultures, technologies, people, et al.
Even with this ability, though, we humans are a pretty self-centered bunch. We will connect things in fictional stories to things in our world and our experience almost by instinct, and that's where the magic happens.
As other people in this thread have stated, politics and morals DO get conflated a lot, but it doesn't happen for no reason: One's moral compass is often a factor in determining political views, and at times the same can even work in reverse (especially when one has been deeply mired in a political sector for a very long time: someone who has been a member of a political party for 3 decades may decide what they consider moral or immoral only AFTER their political party has taken a stance on it, and their primary reason for viewing it that way is simply because it aligns with their party.)
The two concepts of morality/ethics and political alignment are nigh inextricable from one another, so it can be very easy to conflate the two. If you want great examples of political and ethical problems being presented in fiction effectively, I would point you in the direction of... Most of the Star Trek franchise, Especially The Next Generation and Deep Space 9.
The great advantage that fiction has in general is that it can make the abstract into something tangible: in fantasy worlds, religious beliefs don't have to be just an internal personalized understanding of the world, but can instead be real, literal, and direct things for the characters to interact with. Sides in a political conflict can become entire civilizations, armies, or governments. In science fiction, Genetic enhancement and human alteration aren't ideas we talk about maybe happening, they're real, actually possible procedures that the characters in the story have to grapple with.
With this in mind, fiction is a great way to explore political ideas and arguments, but it's also easy to be lazy as all hell about it.
For starters, the real world is messy and complicated and busy and confusing. There are almost eight billion people on this planet, and every single individual one of them has an entire life story filled with twists, turns, upsets, complications, struggles, triumphs, and everything else life usually comes with. As John Galt first wrote, "Every traveler is necessarily the hero of his own story", but in a fictional story, you have an actual hero, or at least protagonist, and creating a fully realized world around that protagonist is a lot of work.
In the real world, when two people are on opposite ends of a political framework, they are that way because of millions upon millions of tiny moments, decisions, and interactions that have led them to hold those beliefs for what they each consider to be perfectly justifiable reasons. They have their own justifications, experiences, research, and worldview to back up why they see things the way they do.
Portraying a conflict that nuanced and complicated in fiction can be difficult, and can often lead to oversimplification. A simple 'I'm right/you're wrong' dynamic says very little of any substance, only that the author agrees with a certain political viewpoint, and that usually can't carry an entire story.
Again, Star Trek is an incredible example of these moral quandaries being portrayed with a complex, layered understanding of what makes human (or humanoids, as it were) interact. Conflicts from euthanasia to military surveillance to self-centered judgment of an alien culture come up over and over again, and Star Trek doesn't just hand you an answer. The show often portrays the good guys not getting their way, not because they're morally in the wrong, but because cultures don't change overnight, or because they don't just get to barge in and tell a culture they just met for the first time how to live their life, or sometimes because things just don't get a neat and tidy resolution in the end, and you have to keep on trying to make the world a better place anyways.
Very rarely are politics handled well in a story without a clear understanding of both sides: making your 'opposing force' (be they representative of republicans, communists, religious zealots, amoral anarchists, or any other political opposition you want to represent in the story) just mustache-twirling villains who have no reason for what they do other than 'because greedy' does many things to your story, all of them bad:
1: it immediately and irrevocably alienates people who identify with that group. It tells them 'you are the bad guy and you must be stopped', even though, as I said above, they have what they consider to be perfectly valid reasons to oppose you and think they're in the right.
2: it dumbs your story down. 'Your side' won't ever get to present a convincing or well-thought-out argument for WHY they believe what they believe, because the villains are so comically exaggerated that there doesn't need to be any debate over whether it's actually right for them to be opposed.
3: Very, VERY few conflicts in the real world look like this. Even Adolf Hitler (yes, I'm going there) had reasons for what he did: In his mind, his actions were justified. Obviously any reasonable human being could look at Nazi Germany and recognize why his reasoning was so flawed, but he had a very specific perspective that allowed him to think he was in the right. If even that conflict is more nuanced than 'haha me want power', then you can bet that literally any other political conflict is going to also have more complexity than 'us good, them bad'
4: finally, it doesn't actually get your message out there. As I said before, you have alienated anyone who doesn't already agree with you. Presumably if you write a political message into a story, you're doing so in the hopes of influencing the minds of people who don't think the way you think, trying to convince them why you're in the right and they should reconsider. If their views aren't represented accurately or people who think like them are treated as absurd caricatures, then they aren't going to be inclined to listen to what you have to say, they'll just see you mocking them and dig their heels in deeper.
The majority of this all falls under general advice for writing conflict; whether political or not, the more you can understand your antagonist's motivations and reasons for believing they're in the right, the more real your story will feel. With politics, specifically, subtlety is king.
One of the worst examples I can think of is in the Supergirl CW show (which is bad on many, many levels, but for now we're just focusing on one.) In that show, Kara works for a very stereotypical 'girlboss' type character: middle-aged, powerful business woman, worked hard to rise up in a 'man's world', tough-as-nails, you know the drill.
Once or twice per episode, this boss character, Cat, would just stop the show's plot for a few minutes in order to deliver a 3-5 minute monologue on sexism, millennials, environmentalism, or whatever other political topic the show wanted to touch on. Literally nothing else would happen during this. She would just talk at Kara (but actually talk at the audience) about how she views things and how she's right and this is how the world works, and then the monologue was over and the plot would advance once more.
There was no opposition to give counterpoints, no further discussion on how to actually accomplish the things Cat talked about, no illustration of what Cat was saying in the main episodic plot, it was all tell, no show.
Political messaging like this sticks out like a sore thumb, and falls into nearly all of the above issues I described about presenting your political messaging as a flat, one-note 'this is my political belief and the people who don't agree with me are bad guys', in addition to stripping any momentum or intrigue the non-political parts of the plot had.
This turned into a massive essay and I should probably cut it here so that people can finish reading it before the heat death of the universe. Mostly it all comes down to standard storytelling advice: Show don't tell, understand your world and your characters, give them motivations that make sense, understand that everyone is the hero of their own story, and make sure your story is entertaining enough to read entirely on its own, otherwise nobody will stick around long enough to even hear your political message in the first place.
Also go watch Star Trek. I think that's probably the most important thing I was trying to say here, tbh.