I haven't been banned but I know a friend who is in possession of an potential Pokemon that could've been hacked. (He got it through the gts in Pokemon home) I'm wondering if the ban would restrict him from playing Pokemon sword as a whole and then he would have to restart the game or get a new one or would be just be banned from online trades/all online functions.
NO, you cannot be banned from the game as a whole. It will however be banned from onlIne play if it's illegitimate.
You can’t get banned from Sword and Shield as a whole, and you can’t even be banned from a majority of online play unless you specifically use the Pokémon in Ranked battles.
Source: Experience and using shiny Volcanion in online play all the time