You are entitled legally to statutory maternity pay so that will have to continue, if they pay more than statutory that’s down to your employer policy x
You would usually be paid out holidays in your final pay. To maximise what you get give contractual notice in line with your maternity pay ending. So if you have to give 4 weeks notice, resign at 35 weeks
I’m not sure how exactly this would work for you but right before my lo was born I got redundant and what happened is I got paid my maternity pay as a lump sum on my last pay slip same with my holiday. However you’ll probably get some deduction as if you’re quitting your employer is entitled to get the money back for the first 6 weeks of maternity pay when you get the 80% of your usual pay. If I’m right they will only take whatever amount was over the SMP. Hope this helps x