I'll mention first that all of these roles are fluid to some extent, and they have more similarities than differences. A Pokemon you add to your team to be a wallbreaker could feasibly end up sweeping a game, and the same with sweepers simply playing a wallbreaking role. But it's still worth discussing their differences and when you should use each one. (Also, the examples provided will be for the pre-DLC 2 Gen 8 OU metagame.)
Sweepers are Pokemon that are designed to clean up the enemy team after a path is paved for them by their team. Most team archetypes are built around enabling one (or more) sweepers to win the game, and creating a scenario where they can safely set up and win the game. Sweepers need to be fast, because the faster they are, the greater the portion of the metagame they can KO before an opponent hits them back. Of course, they also need to be sufficiently powerful to actually KO opponents. This is why almost all sweepers use boosting moves like Dragon Dance and Swords Dance. Fast sweeper Pokemon with strong offences are often frail, but there are many exceptions to this rule, e.g. SD Grassy Seed Rillaboom and QD Roost Volcarona.
Wallbreakers are Pokemon that can come in on defensive Pokemon and balance cores and start punching holes through them, putting the opponent's team in range of your sweeper's attacks. They are supposed to have immediate firepower that makes them very difficult to switch into, or maybe a boosting move they can use to blow up a switch-in. Wallbreakers are needed on offence builds, because your sweepers are probably going to lose to defensive Pokemon unless those are sufficiently weakened first. Your wallbreakers should synergise with your sweepers; e.g. Specs Magnezone pairs well with SD Rillaboom because it pressures Corviknight and Mandibuzz. Wallbreakers are often vulnerable to the opponent's own sweepers if they are slow (though it is definitely a good thing if your wallbreakers are fast).
There are also cleaners, which is probably the last 'offensive' role to speak of. They are just as important to offence builds as the others, because they provide insurance against enemy sweeps without spoiling your own momentum. Pokemon with high speed or Choice Scarf as well as good coverage can be cleaners.
Which of these roles best suits each Pokemon is based on a very large combination of factors that includes everything you mentioned, e.g. stats and movepool, and other things like ability and typing. It also depends on which Pokemon they synergise with, which Pokemon they are good against, etc. This will be easier to understand with more practice.