Setting is never just a backdrop. It sets the tone for how the character is feeling, it is the environment your characters live in, and like any other character your protagonist interacts with, there is a relationship. While Setting may not be a complete character with it’s own intentions and actions, but it has a physical presence and affects the protagonist like anything else. In the case of Harry Potter, every setting has purpose. The Dursley house is plain, and small, with Harry Potter’s cupboard even smaller, and then house on a rock represents Harry’s isolation all the more.
Note then that when he arrives at Hogwarts, it is large, it is whimsical and fantastical, everything the Dursleys are against, a proper home for Harry, and thus he loves it. Hogwarts isn’t just a school, it is played off as Harry’s true home, and that common theme is parallel with the idea that Voldemort, his arch enemy, grew up in an even more isolated orphanage and refused to go home during the holidays – Voldemort even discontinued his use of the chamber of secrets as soon as the school became under threat of being shut down if the attacks continued.
It is messed with time and again; in the first book, the focus is on the magical aspects of the school, such as Quidditch (which Harry is very good at) and Wizard Chess (which Ron is very good at) and spells (which Hermione is very good at) and the whole school environment plays off as a representation of the good things; the bad things in Hogwarts (trolls, Snape, rogue brooms, the forbidden forest) are a representation of Voldemort’s looming presence.
Setting’s entire purpose may just be to give the Protagonist and the conflicting characters an arena in which to function, at its most basic, however it provides an extra level of Goal, Motivation, Conflict and Stakes if the setting also pulls its weight in escalating drama.