I will not restate the information that is already in this answer.
Games running on different devices can trade Pokemon as long as they're from the same generation (and VC games can't trade with non-VC games), which means a gen 4 game on a DS can trade with another gen 4 game on a 3DS. Unfortunately, there is no generation that runs on both the 3DS and Switch (besides LGPE, but those follow weird trading rules), so you'll need Pokemon Home to transfer your Pokemon to your Switch games.
source
source
Each gen 8 Pokemon stores one moveset for SwSh and another for BDSP. The first time a Pokemon gets traded from one pair of gen 8 games to the other pair, it hides its moveset and learns the last 4 level up moves from at or before its level. From then on, each time it gets traded to a pair, it remembers the moves it knew last time it was in the pair. Other than that, Pokemon technically always keep their moves when traded or transferred. However, gen 2 games won't let you send a Pokemon to gen 1 if it knows gen 2 moves, and gen 8 games will prevent you from selecting certain moves if your Pokemon knows them.
source
source
source