Since Brexit, the answer is unambiguous: yes, a valid passport is mandatory for all UK citizens traveling from Glasgow (or any UK airport) to Spain.
Pre-2021, UK citizens enjoyed freedom of movement throughout the EU, including Spain, using only a national ID card or even a driving license in some cases. The UK's departure from the European Union ended this privilege. Spain remains an EU and Schengen Area member; the UK is now a "third country" for immigration purposes.
The UK-Ireland Common Travel Area covers only the UK, Ireland, Channel Islands, and Isle of Man. Spain is not included. Scottish residency or an Irish passport (if eligible) changes the calculus—but a UK passport alone requires full third-country entry compliance.
Bottom line: check your passport's issue and expiry dates before booking. The days of hopping to Málaga on a driver's license are gone.