I usually hear "Be careful what you eat" and also Google is telling me that but it seems "Be careful for what you eat" to me right.
Could you please explain which one is right and why please?
Be careful what you eat is the normal expression, with Be careful of what you eat a possible alternative. I can't imagine any native speaker saying Be careful for what you eat.
Be careful for is rather archaic. You may have heard it from Biblical quotations, for example Philippians 4:6 KJV, "Be careful for nothing" where it means "Do not be anxious about anything". From the Ngram you can see "Be careful for" has never been very widely used, and the specific phrase "Be careful for nothing" accounts for around half of all occurrences.
I suspect that you do not mean "Be anxious about what you eat," anyway; merely "Pay attention to it." [Edit: I doubt that Eminem meant "Be anxious" either, but poetry/music (or rap) is different from normal prose or speech.]
Normally these days, be careful is paired with about or of, and I believe those prepositions have subtly different usages which are principally idiomatic and difficult to formalise. My experience matches the Ngram and about is used more often than of. You are unlikely to go wrong using about.
To express the imperative form of using care about something, the following constructions may be used:
Be careful that you don't leave up the toilet seat.
Be careful to not leave up the toilet seat.
Be careful not to leave up the toilet seat. (Alternate form: "to" and "not" may be inverted)
Be careful what you put on the toilet seat.
Be careful of the broken toilet seat.
Note that the first two constructions above are most commonly used when suggesting that someone refrain from an action.
There is no such construction "Be careful for..."
Fashions in choice of prepositiion come and go. However, I am surprised that no-one has yet mentioned be careful over(your work). Generally applied to situations where care is required, particularly care over a process rather than an event, I think.