Paying for healthcare is an unquestionable drag, but a necessity nonetheless. But a new survey from Harmony Healthcare IT reveals a disturbing trend among millennials: An estimated 65% aren't setting aside funds for a healthcare emergency.

That's problematic because a costly medical issue could easily result in a multihundred-dollar bill. And if you wind up in the hospital, your care could climb into the thousands.

The good news? You can save for healthcare in a tax-advantaged fashion and reap some perks in the process. Here are two options to consider.

Man on crutches

IMAGE SOURCE: GETTY IMAGES.

Flexible spending accounts

A flexible spending account, or FSA, lets you allocate funds for healthcare costs that must be used up on a yearly basis. Currently, you can contribute up to $2,700 a year to an FSA, and that's all money the IRS can't tax you on. This means that if your tax rate is 24%, and you put in the full $2,700, you'll save yourself $648 in the process, all the while ensuring that you have money to tap in the event you're slapped with medical bills.

That said, you don't want to overfund an FSA too heavily because money that goes unclaimed due to a lack of medical expenses gets forfeited. Your best bet, therefore, is to estimate your healthcare expenses year by year and pad that figure by 10% to 15% for unplanned medical costs. If you don't encounter a healthcare emergency during a given plan year, you can use your remaining funds to pre-order prescriptions for the upcoming year, get new eyeglasses, or stock up on covered medical supplies.

Health savings accounts

Health savings accounts, or HSAs, are actually a much better place to house your medical emergency cash. That's because unlike FSAs, HSAs don't require you to deplete your plan balance year after year. Quite the contrary -- the whole point of an HSA is to contribute more than you expect to use up in a given year, invest the rest, and grow it into a larger sum. You can even carry your HSA balance all the way into retirement.

HSAs are triple tax-advantaged. The money you contribute goes in tax-free, growth on your investments is tax-free, and withdrawals are tax-free, provided they're used for qualified medical expenses. Currently, you can contribute up to $3,500 a year to an HSA as an individual and up to $7,000 as a family. And if you're 55 or older, you get an extra $1,000 as a catch-up contribution, just as older savers get catch-up contributions for IRAs and 401(k)s.

There's just one catch with HSAs, though: To qualify, you must be on a high-deductible health insurance plan, defined, at present, as $1,350 or more for individual coverage or $2,700 or more for family coverage. Your annual out-of-pocket maximum also can't exceed $6,750 for an individual or $13,500 for a family. But if you are eligible, an HSA is a great place to stash some money for medical emergencies.

Cash savings are important, too

While FSAs and HSAs offer clear tax benefits, in addition to funding one of these accounts, you should reserve some money in cash to cover immediate healthcare expenses. Often, with an FSA or HSA, you need to pay for your care up front and get reimbursed after the fact. Having money in the bank to do that with is therefore essential, especially since you never know when a medical emergency will strike.