llevar vs hacer (time)
Both express how long something has been going on — but they're built differently and can't be swapped.
llevar
How long you've been doing something continuously — built into the verb itself.
Llevo tres años viviendo aquí.
I've been living here for three years.
Llevar + time + gerund. The ongoing action is baked in. Elegant and very Spanish.
Llevaba dos horas esperando.
I'd been waiting for two hours.
Imperfect of llevar for past ongoing. Works exactly the same way.
¿Cuánto llevas aprendiendo español?
How long have you been learning Spanish?
The natural way to ask. 'Hace cuánto' also works but this sounds more fluent.
hacer
Hace + time + que — how long ago something started, or how long since something happened.
Hace tres años que vivo aquí.
I've been living here for three years.
Same meaning as the llevar version but different structure. Both are correct; llevar feels more natural in speech.
Hace dos horas que te espero.
I've been waiting for you for two hours.
Emphasis on duration from the speaker's point of view. Slightly more dramatic than llevar.
Hacía mucho que no te veía.
It had been a long time since I'd seen you.
Imperfect hacer for past context. Common opener after a long absence.
Tricky bit
English speakers often try 'estoy viviendo aquí por tres años' — wrong on two counts. Spanish doesn't use present continuous for ongoing duration, and por isn't used this way. Use llevar or hace.