What the cards cover
They provide access to medically necessary state healthcare during a temporary stay under the rules of the country providing treatment. Treatment may be free or may carry the same patient charge paid by a locally insured person. The card does not promise that every treatment will be available without charge.
What they leave out
The cards do not cover private healthcare, planned treatment abroad or repatriation. They are not substitutes for travel insurance. A private clinic displaying an EHIC symbol in general search results should not be assumed to provide public treatment.
Moving to Spain changes the question
A resident needs to establish which system is responsible for healthcare. Depending on work, pension and coordination status, the route may be Spanish Social Security, a registered S1 or another recognised entitlement.
Students should check the entire stay
Some European and UK students may remain covered by their home system for a temporary study period. Confirm the duration with the issuing institution and compare it with the exact visa or residence instructions. An expiring card does not evidence cover for a longer course.
A card may not answer a visa checklist
A temporary-stay healthcare card and a visa insurance certificate prove different things. The deciding authority may ask for evidence covering a stated period and particular risks. Use its current checklist rather than relying on the card's existence.