Players using the spear charge can maintain this attack after death and inflict damage. This is especially noticeable when using the spear in PvP, as both players will often die after charging at each other even when one player lands a charge earlier.
To reproduce, place down a command block, set it to repeating and always active mode, then insert the following command into the block:
summon minecraft:silverfish ~ ~15 ~ {Silent:1b}
Get a highly durable spear (such as diamond or netherite), be sure you’re in range of the silverfish so they fall right into the spear and die before touching the ground, then place a magma block below. Lastly, go into survival mode and let your health deplete until it gets low. Once it does, charge while facing the silverfish, noticing that they continue to get skewered even after you die.
This is the case for mobs as well.