Conditions under which the bug occurs: Raid has more than 1 player, any player tries to dodge an attack that would KO their attacker.
What the bug does: Puts the pokemon into a state where it's not fully alive but not dead either. The pokemon is invisible, deals fast move damage (at least some of it), can't use charge moves and has as much HP left as it would have if the dodge had been successful. It can be changed out and will die properly when that remaining HP has been taken out by the boss.
How to avoid: Don't dodge if the raid boss's move would KO your attacker.
(Solo raids suffer from a different bug that is likely related, but is usually referred to as "phantom hits", where damage from raid boss charge moves seem to get applied from out of nowhere. It's usually also related to dodging.)