How long would you be in Morocco?
I don't know entry requirements for going in, but coming back into Europe I believe the AHC can be used provided it is within its 4 month validity period.
But when you are in Spain, it's worth trying to get a Pet Passport there (Spain rather than France, because France has additional rules for microchip registration). It's advisable to get a rabies booster at the same time because if the passport issue date records a rabies booster date earlier than the passport (ie copied from your old documents) it doesn't prove this dog is the one vaccinated. You need a booster at some stage to make the passport properly valid. There's no harm in having the booster a bit earlier than its due - I wouldn't personally want it done within weeks of the last booster but a few months before the next one due is fine.
In Northern Spain you are more likely to be able to get a three year rabies booster than Southern Spain, where they only last a year. That's important because any future rabies boosters need to be done and recorded by a vet in the EU, a UK vet entering anything in a EU passport invalidates it.
The cheapest AHC I've seen is about £99, you need a fresh AHC every time you go out of the UK, but my pet passport and rabies booster cost the equivalent of £41.65 and is valid for life. If you can say eoughly which part of the UK you are in, I might be able to suggest a lower cost AHC vet for the first part of your trip.