I guess the rule would be "if there is a kanji for something, then use it".
Exception: If it's too archaic, and has been replaced by hiragana in the last few decades.
The only way to learn about this exception is through study. But you don't need to worry too much about this exception when you are starting out, because you are unlikely to come across anything archaic in the course of your study until you at least hit intermediate level, and maybe not even then.
For example there are kanji for verbs like "suru" 為る and "iru" 居る, but these days they are not often used. If you use them, people will understand them, though. Some people might have trouble with words like 手強い (tegowai, tough) where the kanji have unusual pronounciations and aren't often used these days, but that is really their problem!