Quick answer
tú = informal you: friends, family, peers, children, most people your own age.
usted = formal you: strangers older than you, officials, customers, anyone you want to show respect to.
Watch the verb: usted takes third-person forms (usted tiene), which is the part learners forget.
Side by side
Memory trick
Start with usted with any adult stranger and let them downgrade you. Being slightly too formal reads as polite; being too informal reads as rude.
Typical mistakes
¿Usted tienes hijos?
¿Usted tiene hijos?
Usted takes the third-person verb form, the same one used for él and ella. Mixing usted with a tú ending is the single most common slip.
Usted, ¿cómo te llamas?
Usted, ¿cómo se llama?
The reflexive pronoun has to shift too: te belongs to tú, se belongs to usted.
Check yourself
You are speaking to a police officer. Which is right?