If you’ve been in their shoes, being open about a similar experience you’ve had can help build trust in the relationship, but share wisely and acknowledge where there are differences and that although something worked for you it may not be what works for them. The goal is to empathize with them not fix them; to offer hope, not impose a solution.
An exception to not giving advice is when someone needs a nudge to go get professional help. In addition to listening, being there for someone means connecting them to help. Let them know that there are people they can talk to who can help (like a school counsellor, family doctor or helpline), and that they don’t have to go through this alone.