ok, ultimately, there are multiple glitches that happen regarding what is done the turn prior too, or along with the switching, ill post some examples and the usual outcomes:
Pokemon A and pokemon B are battling against eachother:
A attacks WHILE B switches: B switches turn ends.
A switches WHILE B switches: Both Pokemon switch, to the new designated pokemon, although, this is only asthetically, as the movesets on the pokemon are still the same as the prior pokemon, and as long as the sprite of the new pokemon exist outwardly, the new pokemon can take damage from next turn attacks, while the old pokemon who tried to switch out (still existing in variable stats and movesets) takes no damage and the battle never ends as the old pokemon becomes invincible within the sprite of the new one.
A switches THEN B kills the new pokemon switched (if move somehow works *rarely*): The new pokemon and the old pokemon become the same pokemon again, allowing for the old one to be invincible.
A uses (explosion,self-destruct,last resort) B faints: Both pokemon are forced to switch out, forcing the occurances of "A switch WHILE B switch" to happen, not only that, but as the original pokemon is already fainted, the new pokemon does not come out and become the same pokemon as its predecesor, sadly, the new pokemon loops infinitely with the game stating "_____________ has fainted" after every turn, regardless of what both trainers try to do. *this is the reason why these moves are broken in PWO, they used to work to an extent*