In reasonable countries, being fired is usually better, since you get severance and can more easily access unemployment programs.
Ideally, you'd want to already have a new job before resigning.
But in case where you can't do that (working 16 hours a day, no days off... basically no time for anything outside of work and somewhat sleeping), then quitting on the spot is good. You could also do something bad that gets you fired, so that you get severance, etc, but that is tricky to do. You'd have to do something bad enough for them to fire you, but not bad enough that other companies think that hiring you is a bad idea. And idk if they fire you that way, whether you still get severance pay or not.