Dead worms in other parts of your body get attacked and broken down by your immune system. An abscess could form around a large one (or around a nest like in filarial worms) and take some time to disappear.
Dead blood flukes (schistosomes) can end up in your circulation after their suc ker detaches and end up in your spleen/liver where they get broken down.