If the HSA is associated with a group health plan through work, then you need to check with your employer to see if Medicare pays primary or secondary to the group plan. If Medicare is secondary, you can wait until you retire and lose the group plan before enrolling in Medicare without penalty. In this case, you can continue contributing to the HSA since you are not enrolled in Medicare.
If the HSA is associated with an individual plan through the ACA exchange, then you should have terminated the exchange plan effective September 1. When you enroll in Medicare later than you should have, Part A will be retroactive back to September or retroactive back six months, whichever comes later. You cannot contribute to an HSA any month Part A is effective. You can obtain a form from the HSA Administrator requesting that ineligible contributions be withdrawn and returned to you.
If you miss the Medicare initial enrollment period, there is a general enrollment period from January 1 - March 31 each year but the effective date is July 1 of that year. For each 12 month period you are late enrolling in Medicare Part B, there is a 10% permanent penalty. There is a 1% per month late enrollment penalty for Part D when you miss the initial enrollment period.