Depending on the player's choices made in the game, Sans' role can drastically differ depending on the route at hand.
In the Neutral Route, Sans will judge the protagonist in the Last Corridor before confronting Asgore. His judgement will vary depending on how much experience points or levels the player has gained throughout the game. He will also call the player character at the Neutral Route's epilogue once they've beaten Flowey. He will discuss the aftermath of Asgore's death and what impact it had on the Underground's citizens. If the player has killed off Papyrus, Sans will discourage the protagonist from ever returning to the underground.
In the True Pacifist route, he will be absent from the Last Corridor, but will be there for Frisk along with practically every important character in the game including Papyrus, Asgore, Toriel, Undyne, and Alphys. Once Frisk has defeated Flowey, he/she can decide whenever to lead Sans and the other 5 or not up to the surface.
However, if the player knowingly decides to kill every single monster in battle through the Genocide Route, Sans will be fought in battle within the Last Corridor as a very relentless opponent, cementing him to be arguably the game's most difficult boss battle yet.
Sans has received very positive feedback from numerous fans for his laidback personality and hilariously bad skeleton puns. Many also admire his big brother relationship with Papyrus, which has touched many player's hearts, especially with certain endings to the Neutral Route.
Many fans also enjoy his boss battle theme "Megalovania", which had existed in Homestuck and even in Earthbound's Halloween Hack, both of which were worked on by Undertale's main developer, Toby Fox.
However, many players unanimously agree that Sans is by far the most difficult boss in the game, but only throughout the Genocide Route.