dessiato and others will know the Spanish process better than me but the Portuguese system pre and post Brexit is simple and easy to do.
I live in Portugal voted Brexit. My residency application was to go to Town Hall, take a ticket at general enquiries, and ask for a five year residency. Documents were a passport, NIF which is the finance number ( easy to get ), address ( which can be anywhere in Portugal, (permanent or temporary) . Took 15 minutes. Earlier this year I applied online for a biometric certificate of residency that makes life easier at airports.
Initial residency is 5 years then you apply for ten years via SEF and then permanent. There is talk about changing the process so after five years the application is for permanent. Residency is not the same as citizenship but you can apply for that after five years and hold dual nationality.
If you were in Portugal before January 31st and hadn't applied you can still apply under that scheme as the Govt says you were here legitimately under previous rules. For those who arrived after Jan 31sts, the procedure is similar after 90 days but the application is to SEF ( Border Control and Immigration) online or by appointment at the local office. Proof of earnings is around the equivalent of the unemployment benefit in either savings, UK income or a job contract here.
There have been extensive social media by the British Embassy on Facebook including videos, Portuguese govt websites including SEF have everything in English and videos to watch. There has also been a joint UK and EU funded campaign to engage with the hard to reach ie very old, those with disabilities and those without internet and transport. Most deadlines have been extended due to the covid restrictions which have impacted on physical applications and appointments and the introduction of online resources and their inevitable teething problems. Can safely say that deportations here are going to be the very very last resort unless someone has been caught up in serious criminal activity.