There are two kinds of abdication civil wars.
- "Overthrow Ruler" casus belli. This is usually the direct consequence of a failed imprisonment, title revocation or similar tyrannical action. These wars are titled "Revolt against the rule of [your character]" or "War against the tyranny of [your character]". If you lose this war, you abdicate to your heir. If your heir is of your dynasty, you will then continue playing has them. So this is usually not that bad as long as you have a dynastic heir, the heir is an adult, isn't completely incompetent and your succession laws do not split your realm among multiple siblings.
- The kind which gets declared by a faction which has a specific person they want to replace you with. If you lose this war, you lose your kingdom title, but you will keep all your duchies and counties and you will retain a strong, inheritable claim on the kingdom. That means you will likely end up as a rather powerful vassal below the new king and might have a pretty good chance to take the crown back eventually. Still very likely a major setback in whatever master-plan you were pursuing.
Imprisonment by another ruler means that you will potentially play with a regency for a pretty long time. Regencies are not much fun to play, because they limit your options and can screw you over in a lot of small and large ways. Writing them all out would be enough material for another answer, so if you want the details I recommend reading the wiki article. Let's just say: You do not want to be in a regency for an extended period of time. So all you can hope for is that you die soon or that your captor gives you a chance to leave prison (suddenly likes you and lets you go, offers you to pay ransom, tortures/mutliates/humiliates you if you have the "Reaper's Due" dlc). But if you are not so "lucky" and your character is rather young and healthy, you might spend several decades in prison while a line of corrupt regents ruins your kingdom.
Assuming a "usual" situation, I would prefer abdication over imprisonment over getting replaced, but depending on the circumstances you might have good reasons to prefer these in a different order.