In Pokémon Sword and Shield, as far as Experience Candy is concerned, Nintendo did not reinvent the system from scratch but was based on Pokémon: Let's Go, Eevee! and Pikachu !.
Experience Candies are somewhat comparable to Rare Candies: give your pokémon experience points depending on the size of the candy itself, which can range from Extra Small (XS) to Extra Large (XL). To obtain more candies and therefore more experience you will have to jump into the Max Raid. The higher the difficulty of the raid, the greater the size of the candies that will be delivered to you as a reward. Generally, in Pokémon Sword and Shield, for a 5-star Max Raid you will get some Experience Candy L or XL. If the raids are two-star they will generally bring S or M candies. Although the high ranking Max Raids are longer to undertake it will be worth it. Plus, even if you don't want to catch Greedent, beating him will give you a lot of candy rewards.
You can also get candies by talking to non-player characters in the wild areas: they will exchange them for a few Watts but raids will always remain the best way to farm candies.
► Pokémon Sword and Shield is an RPG type game developed by Game Freak and published by Game Freak Nintendo for Nintendo Switch, the video game was released on 15/11/2019