Firstly, well done. Your friend has confided in you because you are approachable and they felt safe doing so. Great job you!
Secondly, have a think about why they confided in you. Did they
1) Just want to get it off their chest - a problem shared is a problem halved? Or
2) They confided in you because they want your help?
Here are some useful tips on how you can support somebody who is struggling, whether that's to just be a good listening ear, or whether it's for some practical help. Don't forget that it's important to take care of your own health when supporting somebody else. You are not responsible for their happiness, only your own.
Remember, you are not a professional and you should not be burdened with a problem which you feel is unmanageable. If your friend is an MDX student you can encourage them to access the Counselling and Mental Health Service (link to the right of the page), or if you are concerned about your friend's health you should follow Care and Concern procedures (link also to the right of the page). If they are not an MDX student and you are worried about their mental health, you should encourage them to make an appointment with their GP. If you are immediately concerned that they are going to hurt themselves or somebody else, you should call 999.