Please read:
Cross Border Workers
Click ´healthcare´ and then ´working in one country, living in another´ for full info on forms you need to transfer your right to healthcare to the country you live in.
Click ´unemployment ´and then ´cross border commuters´ for info on the the PD U1 form, a ´portable document´ that you need to apply for in the country where you worked, in case you are let off and need to claim unemployment benefits in the country where you live. Note: Gibraltar requires you to apply for this form within 6 months. Form also available as Structured Electronic Document SED U002. The unemployment office in the country where you claim unemployment benefits can also ask the authorities in the country you worked and contributed, for information re your entitlement, but it speeds things up if you can present the PD U2 form yourself, at the time you apply.
Useful Forms Social Security Rights
Info on family benefits and pension info also available through the link above (the latter under ´retirement´).