Disclaimer: what I’m about to say is mostly drawn from Chinese (native speaker – it was my secondary language growing up), but most of the kanji knowledge I have from Chinese has carried over nicely to Japanese so far (and if it’s any comfort, I’ve been studying Japanese for 4.5 years now and have an N1).
I don’t see these kanji that often in Japanese, but from what I know:
- 土 is soil i.e. earth as a material or substance, and that can be extended to mean ‘ground’ or ‘land’ because 土 is what usually covers those things
- 地 is earth as an overarching concept, place, layer and so on. It’s slightly more abstract and can be extended to refer to the base or fundamental/lowest layer of something, like someone’s true nature
Funnily enough, ‘dirt’ is the one synonym I probably wouldn’t use to translate or explain 地. ‘Dirt’ is too physical, and more importantly too close to the material the earth is made up of, as opposed to simply referring to some monolithic, typically expansive thing.
You’re right that they’re closely related – heck, there’s even a 土 in 地 (on the left) – but they’re definitely not the same, and typically aren’t interchangeable. Still, honestly, you’ll eventually learn vocabulary and expressions in which one or the other is used, so I guess it’s not that bad if you mix them up – usage will eventually help you differentiate the two.