The Traditional 401k is just like the Traditional IRA in terms of early withdrawal penalties and income tax.
If you repeat the cycle the next time there won’t be a retirement account to tap to bail you out. You might take a hit on the dollar value, but clean out your house and sell all of your unnecessary items in order to pay off debt.
Again, you’re taking a huge hit and paying a ton of money in taxes and penalties.
The early withdrawal penalty and income taxes you pay are just the beginning of the costs of using your retirement account to pay off debt.
Your to a Roth IRA will never be taxed again so you can withdraw them at any time.
(This is why some people get started with a Roth IRA since they can also use it as a quasi-emergency fund if needed.) However, any earnings generated on top of those contributions would be subject to tax and penalties if withdrawn before age 59 and 1/2.