If a Withdrawal Agreement is reached, during the transition period you will be able to travel from Spain to the United Kingdom and vice versa under the same conditions as before the exit. For this, you must have a valid passport or national ID, but no visa will be required.
If the Withdrawal Agreement is not approved, after its exit the UK will be considered a third state and you must be prepared for the changed circumstances.
To travel between the UK and Spain, or vice versa, you will have to have a passport and may be required to have a visa. However, the European Commission has agreed to waive visa requirements for stays of under three months for British citizens, provided that European citizens wishing to enter the UK receive reciprocal treatment.
The European Commission has prepared a document with questions and answers giving information on this matter.
Specifically, if you are travelling to Spain from the UK you may find useful information on customs, VAT returns, plants or cash declarations at the following link: Travellers