The UK has a treaty with the Rep of Ireland which predates the EU. This allows free and unhindered travel, work, residence, access to healthcare, benefits and voting rights in both countries. This is normally called the ‘common travel area’.
Neither country has been, nor is, part of Shengen, so although an Irish passport holder can have unlimited stays in the EU, and can reside, work etc in the EU as EU citizens, they still have their passports looked at by customs. On a recent visit to France my Irish passport was scanned (as was my vaccine passport). I cannot speak for routes into Spain from Ireland but imagine the same rules should apply by EU edict.
It follows that a UK passport should be ‘picked up’ at point of arrival in Shengen.
Davy