Second to housing, healthcare is typically the average senior's greatest monthly expense. It's also an unpredictable expense, since medical issues and rising Medicare costs can come in higher than expected.

That's why it's crucial to save for retirement smartly during your working years -- and often, that means capitalizing on tax-advantaged savings plans like IRAs, 401(k)s, and HSAs. But new data from Nationwide reveals a disturbing trend with regard to the latter: An estimated 52% of future retirees aged 50 and over who contribute to an HSA only use it for current healthcare expense. And that's a mistake they're likely to regret in the long run.

How HSAs work

Short for health savings account, an HSA is effectively a hybrid savings and investment plan. The money you contribute goes in on a pre-tax basis and can be used to pay for near-term medical expenses like doctor visit copays, medications, or durable medical equipment. Any funds you don't use immediately, however, can be invested for tax-free growth and withdrawn at a later point, tax-free, to cover healthcare expenses as they arise.

Older man taking a pill while holding a glass of water.

IMAGE SOURCE: GETTY IMAGES.

It's the latter option that makes HSAs particularly valuable. When you overfund your HSA so that you don't use up that money from year to year, you can invest your remaining dollars and grow your balance into a larger sum. That way, when retirement rolls around, you'll have a dedicated savings account you can tap for medical costs. By using up their HSA balances for immediate healthcare expenses, older workers are missing out on a key opportunity to sock away funds for medical costs in retirement, and to benefit from the tax-free growth on investments HSAs offer.

The takeaway? Start overfunding your HSA if you're not in the habit of doing so already. Estimate your healthcare expenses for the year, but then pad that amount so there's money left over to invest and carry into the future.

Of course, you are limited to a certain contribution threshold with HSAs that changes from year to year. Currently, you can contribute up to $3,500 to an HSA as an individual or up to $7,000 as a family. If you're 55 or older, you're allowed an extra $1,000 on top of whichever limit you qualify for. And if your employer is willing to make HSA contributions for you, which some are, whatever sum goes in on your behalf counts toward the aforementioned limits.

Keep in mind that not everyone is eligible for an HSA in the first place. 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. You also must have an annual out-of-pocket maximum of $6,750 as an individual or $13,500 as a family. But if you do qualify, be sure to maximize your HSA by setting aside enough funds to cover future healthcare costs. Once you retire and move over to a fixed income, you might struggle to keep up with your medical expenses, so the more money you have in your HSA, the less financial stress you'll experience during your golden years.