Healthcare is a burden for people of all ages, and covering it is easier said than done. In fact, Americans struggle so much with medical costs that they're the No. 1 reason U.S. adults are forced to file for bankruptcy.

But new data from TD Ameritrade reveals that the high cost of medical care may be driving people to make a very poor decision: withdrawing funds from retirement savings. A good 49% of Americans across all age groups say they'd likely go that route if faced with healthcare expenses. If you're thinking of doing the same, you should know that you may wind up sorely regretting it after the fact.

The dangers of tapping retirement funds

The purpose of socking money away in an IRA or 401(k) is to ensure that you have enough income to pay the bills in retirement. But if you withdraw funds from one of those accounts before your senior years roll around, you'll have less money available to you later in life, when you really need it.

Doctor reviewing document with man

IMAGE SOURCE: GETTY IMAGES.

Don't forget that when you take an early IRA or 401(k) withdrawal, you don't just lose out on the principal amount you remove; you also lose out on the sum that amount could've grown into. Imagine you withdraw $10,000 from a retirement plan at age 40 to pay for medical bills. If you don't actually retire until age 65 and your investments in that plan generate an average annual 7% return (which is a reasonable assumption given the stock market's historic performance), you'll end up losing out on over $54,000 of retirement income when you account for investment growth.

Not only that, but taking an early retirement plan withdrawal -- meaning, a withdrawal prior to age 59 1/2 -- could leave you on the hook for a 10% penalty on the sum you remove from your account. You may be able to avoid that 10% penalty if your medical expenses exceed 10% of your annual adjusted gross income (AGI), but if your AGI is $70,000 and you take a $5,000 IRA or 401(k) withdrawal to pay for medical bills, you won't be exempt from that penalty, which means you'll automatically lose money in the course of accessing that cash.

A better way to handle medical bills

If paying for healthcare is a concern for you, your best bet is to save as much as you can in a health savings account, or HSA. Beginning in 2020, you'll have the option to contribute up to $3,550 in pre-tax dollars -- the same type of pre-tax dollars that fund a traditional 401(k) or IRA -- to an HSA as an individual, or up to $7,100 for the year as a family. And if you're 55 or older, you can put in another $1,000 on top of the limit that applies to you.

HSA funds never expire, so there's no need to worry about overfunding your account. And withdrawals from HSAs are always tax-free as long as you use that money for qualified medical expenses. Also, HSAs, like 401(k)s and IRAs, let you invest your money while you're not using it, which means you can grow your balance over time if you don't deplete it year after year.

The only catch with HSAs is that you must be enrolled in a high deductible health insurance plan to participate. In 2020, you'll need a deductible of $1,400 or more as an individual or $2,800 or more as a family to qualify. If you can't save in an HSA, you can revert to a flexible spending account (FSA) instead -- though generally, you'll need to sign up for one ahead of time, which means that if you haven't already funded one at this point for 2020, that option is probably off the table unless you experience a qualifying life event next year, like a marriage, divorce, or birth of a child.

Let's be clear: Tapping a retirement plan to pay for medical bills is very different than raiding that account to improve your home, buy a car, or take vacation -- but it's still not the best idea. You're much better off opening an HSA, assuming you qualify, and leaving your retirement savings to serve their intended purpose.