Will i take into account the periods worked in Spain if i transfer to The United Kingdom?

Yes, in the uk you can assert in Spain periods before and after the end of the transitional period. you need to reside and work in Last place in The united kingdom.