The words "important TO me" imply inherent, ongoing value:
"You are important to me."
"Spending time with my mom is important to me."
The words "important FOR me" imply conditional or future value:
"It's important for me to stay focused right now." (... so that I can finish this project)
"It's important for people to go for regular check-ups with their doctor (... so that they can stay healthy or get an early diagnosis of any new illnesses or diseases)
We could have quite similar sentences that change meaning slightly depend on whether "TO" or "FOR" is used:
"It's important TO me to get good grades." (It is always important, because it reflects on my self of value and character in the present.)
"It's important FOR me to get good grades." (It is important to avoid conflict with or punishment from my parents later on, or because I will be kicked off the football team if I don't, or because I want to get into an elite university in the future. The value is not directly in getting the good grades; rather the value is in what the good grades will help me get or avoid in the future.)