Advertir vs. avisar
Both 'advertir' and 'avisar' are Spanish verbs that can be translated as 'to warn' in English, but they have slightly different connotations and uses in certain contexts.
Advertir
'Advertir' is usually used in the sense of noticing or observing something and pointing it out. It is often connected to a risk or danger that has been acknowledged. It also carries the connotation of advising or cautioning someone about something.
Te advertí que no jugaras con fuego.
(I warned you not to play with fire.)
Si adviertes algún problema, dímelo de inmediato.
(If you notice any problems, let me know immediately.)
Los médicos nos advirtieron sobre los riesgos de la cirugía.
(The doctors warned us about the risks of the surgery.)
Avisar
'Avisar' is a bit more general and it's used when you want to inform, notify or alert someone about something, which might not necessarily involve an imminent danger or risk.
Voy a avisarle al jefe sobre el cambio de planes.
(I'm going to notify the boss about the change of plans.)
Por favor, avísame cuando estés en camino.
(Please let me know when you're on your way.)
No me avisaste de la visita de tus padres.
(You didn't tell me your parents were visiting.)
Summary
'Advertir' and 'avisar' both translate as 'to warn' but are used differently. 'Advertir' tends to be more serious and immediate, often relating to a risk or danger. Meanwhile, 'avisar' is more general and can simply mean to notify or inform someone about something.