I've been laid off four times and had my contract terminated without notice once:

* Wal-Mart when another Wal-Mart opened across town and business temporarily fell about 25% at the Wal-Mart I worked at.

* Small video game publisher started by a larger developer from Japan, after we released our third game (since I started, they had two other releases) and it got some mediocre reviews and sales. We were in the middle of developing two other games when we suddenly got a call from the parent company to stop booking trips (I was going to be sent to Los Angeles to attend a Nintendo conference the following month) and wait for the executives to fly overseas from Japan to visit the office. We kinda knew it was about to happen then, but I waited it out until it was official. Was pretty sad that happened, probably my favorite job I ever had still.

* Mobile app company when our app didn't find an audience right away and the board members knew nothing about app development but expected us to be instantly successful and got impatient. I was already interviewing elsewhere when I got the official meeting as I could sense it was about to happen.

* Video game company that had become reliant on the moneybags of a guy who mad a few lucky real estate investments and thought he was smart enough to be a video game designer (the president of our company was a known game designer and the client would be lecture him about how he thought he knew more than our president did about game design because he read an article on gamasutra the night before). He pissed away millions on a game we were all pretty sure wouldn't be successful but the president was happy to use to help fund the company while he tried to find other opportunities. All those other opportunities fizzled out, though, for various reasons. I mostly hung on because the other potential opportunities were pretty cool and I was really hoping one would find a publisher or some funding (plus it was a fun job with good people and I was still learning new things). They never panned out, and the main client eventually realized he was wasting millions of dollars on a game that would never be successful and pulled the plug on funding suddenly, and 75% of the company got let go a couple weeks later.

* For a contract I was on, the lead developer walked out after getting pissed off enough one day and started his own consulting business after that (which I think is still pretty successful today). The boss decided a couple weeks later to cancel the internal project and hire a third party to build the project instead. While driving home from the job I had to stop to take a call from the tech services company (that assigned me to the job) telling me not to come to work tomorrow, my belongings in my desk would be shipped to me. I already hated that job so it was a bit of a relief, but it was the most insulted I'd been about how I was let go, where I couldn't even pack up my own things. Put me off contract work for a while after that.

Probably should have been laid off yet again at my previous job, as they struggled for years and had multiple massive layoffs (and major employee attrition besides that), in fact I think my boss once told me I was at one point on the layoff list (he was required to fire a certain number of people by higher ups), except enough people quit I got shifted back into the keep list. I eventually quit from there after staying for way, way too long. Honestly if I was laid off earlier I probably would have been better off, definitely would have had less stress and would have been paid significantly more a lot earlier. Although it was also WFH before the pandemic, so the uncertainty of the pandemic and the certainty that I'd never have to go back to the office while I worked there kept me there until I was vaccinated.

Unless you're like in your 50s or 60s you'll probably be able to find a new job. Might take you a month or two or three of looking, but you'll find one (at least if you're in tech). And you'll probably be in a better position (at least financially) and think "man, I should have quit earlier" once it happens.