It can be difficult seeing a friend in emotional pain and not knowing how to help. Try calling on your skills of empathy to figure out what to do. In simple terms, put yourself in their "emotional shoes" and try to figure out what you would want in that situation. It may not be exactly what your friend needs, but it's a good place to start and your friend can likely lead you in a different direction once you've gotten started (it is extremely difficult for someone in emotional pain to ask for help, but is much easier to say, "can you do this instead?").
Accepting whatever emotions are there in the silence tells them, "I hear you."
If you still seem stuck finding something to do that seems truly helpful, simply being present for your friend is a very powerful gift. No words are necessary. Being able to be truly present in silence with your friend and accept whatever emotions are there in the silence tells them, "I hear you."
Frequently, there is no greater gift in times of emotional distress than that of truly being heard.