Harry Potter and Snape have a lot in common (not just Harry and James)
Everyone keeps saying how much Harry Potter is like his father, James Potter, but it might be Severus Snape, with whom he has more in common.

Throughout the Harry Potter series, Harry and Severus Snape never see eye to eye, but they have far more in common than they might think. Snape often loathed Harry's resemblance to his father, James Potter. However, while he is the spitting image of his father, Harry grows up and behaves differently in Harry Potter. Instead, James' son is a lot like his mother, Lily, Snape's childhood best friend.
Before Harry Potter began, Snape and Lily grew up in the same Muggle town of Cokeworth. While Lily had a fairly happy upbringing, her friend was raised by a witch mother and a Muggle father, who he admits often got into fights. In his conversation with Lily, Snape, who appears on the Pensieve towards the end of Harry Potter and the Deathly Hallows, insinuates his father was abusive, and his oversized dirty clothes suggest that the boy received a lot from his parents Very little care is given. This made the young Snape even more eager to escape to Hogwarts - just as Harry yearned to escape the Dursleys every year.
Harry And Snape Had An Upbringing That James Could Never Understand

When Harry witnesses Snape's memory in Harry Potter and the Deathly Hallows, He saw the moment when Snape and Lily met James Potter for the first time on the Hogwarts Express. Harry noticed how different Snape's appearance was from James, who had the impeccable appearance of a boy who was thoroughly loved and cared for. But of course, James was unaware of his privilege, and when he saw Snape's unkempt appearance, it didn't take long for him to set his sights on the boy and start bullying him.
Harry was uncomfortable witnessing this in Harry Potter, not least because the person he could most relate to in this situation was his professor, whom he had feuded with for years, who in Harry Potter Potter ends with Dumbledore and the Half-Blood Prince killed. So when Harry sees an 11-year-old boy longing to find a safe place to call home, he sees himself. James didn't know what it was like to be abused and neglected, but thanks to Harry's years at the Dursleys, he did.
Before Harry found his place in the wizarding world, his appearance was often described in the same way as the young Snape in Harry Potter. When Harry saw young Snape trying to hide his embarrassment, Oversized clothes, he gets to know his least favorite professor like never before. Young Severus Snape had the palpable sadness and defiant expression of a wounded child on his face. For Harry, it only takes one person to know someone. This suggests that just as James doesn't know Snape, he doesn't know Harry completely.
James Potter Was A Lot More Like Draco Malfoy

Severus Snape's memory of meeting James Potter on the Hogwarts Express - portrayed differently in the Harry Potter films - with Harry's first trip to Hogwarts travels parallel. Not only because Harry and Snape were victims of neglect, but also because they were both the targets of a wealthy bully. In "Harry Potter and the Philosopher's Stone", Draco Malfoy came to Harry's cubicle to express friendship first. However, when it was rejected, the boy quickly turned to brutality (and this went on for several years).
Like Draco, James grew up believing that his father's Hogwarts house was the absolute best, and that any other would be embarrassing. So when he heard that Snape was going to be sorted into Slytherin, James immediately decided that the boy was below him. He also knew very well that Snape was a An entirely different class in the wizarding world. Unlike their Malfoy kin, the Potters may not have embraced the pure-blood mania of Harry Potter, but they're still rich and proud - and James has no problem wielding that influence (like Draco Same).
Harry And Snape Were Both Saved By Lily's Love

When Harry and Snape found true friendship, their growing loneliness improved. For Harry, it was in the form of Harry Potter Ron and Hermione, who stayed by his side for years to come. For Snape, his friendship with Lily pulled him out of the darkness. However, years of abuse at the hands of his Muggle father made him desperate for power and domination. When he refused to leave his would-be Death Eater friends behind, Lily was heartbroken and forced to leave him.
If Snape knew his journey to be worthy of Voldemort's Dark Mark would kill the very person who taught him to love, he would never have continued. Anyway, the decision was made and Voldemort killed Lily. This was Snape's wake-up call. Lily had warned him, but he hadn't listened. However, he made up his mind and made the choice he should always make—— Fight for the forces of good. Lily's kind soul saved Harry's life the day Harry Potter began Voldemort's attack, but it also saved Snape's morality.
Why Snape Could Never See Past Harry's Resemblance Of James

Of course, Snape was far from perfect throughout Harry Potter. Childhood hatred and anger have festered for too long, not even Lily's love can reverse it. So when the Potions Master finally met Lily Evan's son, he was shocked to discover how much he resembled James Potter. Because of this, he was terrible with Harry - and Snape's behavior was even worse in the books.
In fact, Snape scolds Harry for his cheeky personality coming directly from Lily, but Snape doesn't see this. The Boy Who Lived was a physical reminder of all that was wrong with Snape. He may have dedicated his life to defeating Voldemort and protecting Harry, but he lacks the emotional maturity to attribute his bad decisions to Lily and James' son. At the end of Harry Potter, Snape fulfilled his duty to Lily and kept Harry alive - but his kindness was beyond his reach.