John Lund/Marc Romanelli | Getty Images

Older workers have a plum opportunity to sock away even more cash to cover health costs in retirement — provided they do it correctly. In 2019, individuals with self-only coverage in a high-deductible health insurance plan will be able to save up to $3,500 in a health savings account. Those with family coverage can put away up to $7,000. Health savings accounts allow users to save pretax or tax deductible dollars, have them accumulate interest on a tax-free basis and then withdraw the money free of taxes for qualified medical expenses. The deal is even sweeter for older workers: Once you're 55, you can make a catch-up contribution of $1,000 to your HSA. That's where things can become complicated — especially for savers who are married and those who are approaching Medicare eligibility at 65. Here's where you're likely to hit complications when you're funding an HSA and how to overcome them.

Catch-up foul-ups

Vstock LLC | Getty Images

Keeping one HSA if you're married and on a high-deductible health plan might make sense until one of the spouses hits his or her 55th birthday. Let's say that the spouse under 55 is the one holding the account, but the older spouse is eligible for the catch-up contribution. In this case, the spouse who is over 55 should open his or her own HSA and save the additional $1,000. That's because whether the older spouse can make the catch-up contribution will depend on which individual holds the account. There are no "joint" HSAs.

Both 55+

Blend Images - Hill Street Studios | Brand X Pictures | Getty Images

If both spouses hit 55, the only way each one can make the $1,000 catch-up contribution is if they each hold separate HSAs, said Roy Ramthun, president and founder of Ask Mr. HSA. You can't just lob catch-up contributions for both spouses into one HSA, even if the couple is on a family plan. "It would be nice if they could both put the catch-up contributions into one account, but the laws don't allow that," Ramthun said. If both spouses have family coverage, they can split the total plan contribution of $7,000 between the two accounts. However, the $1,000 catch-ups must go into the respective account of the spouse who is entitled to make that contribution.

Hitting 65

Peathegee Inc | Blend Images | Getty Images

Be aware that while you can use your HSA to pay for health costs in retirement, you'll no longer be able to contribute to it once you're on Medicare. Let's say that you turned 65 in July, and you enrolled in Medicare. You were in a plan with self-only coverage.

In this case, you can only contribute to your HSA until June — the month before you enrolled in Medicare. Your maximum contribution for that year would be $2,250 (or $4,500 divided by 12, then multiplied by 6). "If you contribute too much, you'll need to get the money back out," said Julie Welch, CPA and member of the American Institute of CPAs' Personal Financial Planning Executive Committee. You have until April 15 — the due date of your tax return — to remove the excess contribution, which will be subject to taxes.

IRA to HSA rollover