"to care" can be used two ways:
"to care for someone" can mean "to care about someone" OR "to look after someone"
That is, one of the meanings of "to care for" is SYNONYMOUS with "to care about", meaning to be concerned about.
To rephrase this, "to care for" means one of the following:
[1] to look after
[2] to care about
Examples:
Lovers care deeply for each other (meaning [1])
She cares for 10 toddlers at the daycare center. [2]
I don't care how much it costs, I need it. [1]
Please take care of this business today. [2]
"to matter" is the INVERSE of meaning [2]. Take the third example above:
"I don't care how much it costs. I need it." = "I do not care about the cost." SUBJECT= I , OBJECT= the cost
the INVERSE uses "to matter":
"It doesn't matter how much it costs. I need it." = "The cost does not matter to me." SUBJECT= the cost , OBJECT= me
In essence, "to matter" is used to express whether the SUBJECT effects or has anything to do with the OBJECT in any way.
"It doesn't matter what she thinks. I'm going either way."
"It doesn't matter if it's raining. This thing is waterproof."
Most of the time instead of " Y does not matter to X." you will see " Y doesn't matter." That is, the OBJECT (X) is commonly left out and implied as in the above examples.
The first "it" in the above examples acts as a substitute for the condition that comes after "that", "if", "what" and so on.
This is also called the {SUBJECT}.
"{I} don't care that the food fell on the floor, I'm still going to eat it."
"{It} doesn't matter {that it fell on the floor}, I'm still going to eat it."
"{That the food fell on the floor} does not matter, I'm still going to eat it."