The money you deposit into your HSA is yours to withdraw at any time to pay for medical expenses that aren’t paid by your high-deductible health insurance policy or reimbursed by anyone else (so if you have a dental policy that pays part of your dental costs, for example, you can only use your HSA funds to pay the portion of your dental bill that you have to pay out-of-pocket). HSAs are considered part of consumer-driven health care (CDHC), meaning that you control the plan, deciding how to spend and invest those dollars.
You can withdraw the funds at the time you incur the medical expense, or at any point in the future, as long as you had already established the HSA when the expense was incurred. You need to keep careful records either way, but if you’re planning to wait ten years to reimburse yourself for a medical expense, the onus is on you to prove that you had the expense and paid for it out-of-pocket, with non-HSA funds, and saved the receipts.