Apply now!!! In my experience (sciences in US), postdocs are usually interviewed fairly far before they finish. I think I applied in December, interviewed in February, defended that summer, started the next fall. (This was a pretty early start, and it's possible to go faster, so don't panic yet.) Getting a postdoc offer also serves as pretty strong encouragement to your advisor to ensure you can defend and leave in a timely manner.
If you can defend prior to your funding running out, that would obviously be the best. However, there are other options:
- Your advisor finds more funding - nearly as good.
- You find a nonacademic job, and finish your thesis in your spare time. Possible but not great (common in humanities PhDs, which is why they can take ten years).
- You could start with your postdoc group prior to graduating - they might be able to hire you as a "technician" before you finish. You could then write up your thesis in your spare time. Some groups will be OK with this, since they get a PD-level person to start out at a lower salary - but others will object to not having 100% of your focus, or will have grant funding that isn't flexible on this.
Options 2 and 3 are going to be much much easier if you don't have much scientific work to finish - i.e. you mostly need to write up and defend, with maybe some additional computation/analysis. They will be near-impossible if you have additional in-lab work to finish. (I do know of one unusual case with a super nice postdoctoral advisor, where the student finished some of their thesis work in their new advisor's lab. This is very much the exception to the rule.)