When people talk about Mary Sue, they use phrases such as "everyone loves her" and "all the (appropriate gender) were attracted to her".
This is how people want their relationships to be. In this case, it's a falsehood. When I was in college, I thought that I had managed to be, if not friends, then at least friendly with my classmates, specifically those in my major. I went to a small junior college and if there were fifty of us in my major, then I would have been very surprised. Anyways, in my major, I thought I had at least a positively ambivalent relationships with the others until one of the girls rather casually mentioned that she didn't like me. I was floored, because she had always seemed passively friendly.
Not long after that, I had another unusual and highly upsetting experience. My dorm mate was switching dorms leaving me with a future dorm mate to move in. I hadn't heard anything about who the new person would be, but figured it wouldn't be long before they showed up. I had gone out for a while one afternoon and when I came back to the dorms, I was planning to change, grab a bite to eat and do homework right up until a complete stranger stormed up to me and started yelling at me for talking bad about a person I had never met. They didn't explain, or give me a chance to defend myself.
This is real life. Two incidents wherein people I didn't know displayed that they actively disliked me when I had never sought out to create such a feeling in them.
Characters need the same thing. You don't like everyone you know, and it would probably surprise you to realize how many of them don't like you either.
Disliking people, and being disliked, is part of what makes us real. There are characters we all know and love that wouldn't be half as beloved without antagonists, or rivals. The friction of personalities is a treasure trove of interactions. You can reveal so much in a conversation that you can't any other way.
I know the old adage is "show, don't tell", but using dialogue to give an impression of interpersonal relationships does not violate that rule.
There are various levels of interaction, various stages of relationships, and while you may not need to use all of them in the actual story, having an awareness of them can be useful in dictating how your character interacts with others.
Some examples of relationships would be the Best Friend, Mentor, Sibling, Parent, Romantic Interest, Rival, Nemesis, Archenemies, Archival, and Enemy.
There are some other phrases people use, "Brother From Another Mother", "Heterosexual Life Partners", "Soul Mate".
Sometimes, you just have to make up something to define a relationship because that makes it unique and special.
Remember, emotions are key underpinnings to relationships. How a character feels around another character, how they've interacted before, what's happening around them, all of these dictate how a relationship will fall out.
Because of emotional balances, not everyone will get along all the time. That's ok, friction and fights are natural, AND they provide you with opportunities to move on the plot. An argument between the MC and his best friend could lead to said best friend storming off, thus being in the perfect place to see a clue to the villains' ultimate plot.
And what about romance?
Mary Sues are infamous for loving, and being loved by the writer's favorite character. Or any character the writer chooses whether they are suitable and available or not.
While everyone wants and deserves to have a love of their life, as a writer, your responsibility is to show why a relationship works and how it could possibly work.
In fact, you should consider that as an urge, you write the story to explain the relationship. With a little effort and polish, you can convince people that this relationship or that relationship can work.
Here's the thing though. Having a variety of relationships take work and effort. As a writer, your job is to keep track of how your characters are interacting, especially as it furthers the plot. Pulling out the "beloved by all" card for your main character is, in my honest opinion, a cheat. If there's no strife, then there's no challenge in it, because everyone gets along.
Mary Sues are in some ways easy to write, because of their premise. In some ways, they're the perfect way for a lazy writer to create content. Taking the time to throw in some people who dislike, loathe, hate, or antagonize your character gives the story some depth. Even having a fight between best friends gives you something to work on.
Which sounds more interesting to you?
The friendship created out of a partnership founded on the belief by one man that the other would one day find the button to end the world and press it.
The friendship created by two people who just happen to be in the vicinity for no particular reason.
Which of these friendships would you rather write?
Coming up next, we have Mary Sue's name, a discussion.