The temporary driving permit you receive once your entitlement to drive has been checked with the foreign traffic authority, upon handing over your original foreign licence, is ONLY valid to drive in Spain. It says so at the bottom of the permit.
When driving in the UK with this temporary permit, you need to beware of the following. It is an offence not to produce your driving licence, when requested to do so by a police officer. If you don’t have your licence with you then it would be that the police officer will usually issue a ticket requiring you to produce the documents at a police station of your choice within 7 days.
If you are in this situation and then try to hire a car in the UK. The car hire company may accept a code given from DVLA (you´d need to have kept a copy of your UK licence for the details to put in), and if given would mean the DVLA still have you registered as holding a UK licence and your change to a Spanish driving permit has not completely gone through the system. The problem with this is, in the event of an accident or traffic stop and asked for your licence, you could not produce such a licence within the time permitted, indeed at all. That could lead to being summoned to court for failure to produce. Also, there is no way to predict at what time your change to a Spanish driving permit WILL have gone through the system. Could very well be the day after you got the code, or anytime during your rental period.
And of course, there could be an insurance issue, if you are involved in an accident and found not to be in possession of a licence valid to drive in the UK, even though the car hire company accepted the code.