If someone is having a problem, but you're not sure how to help, you can ask:
Is there anything I can do to help?
This shows your support for this person. Another way to phrase this which is more formal but more distant is:
If there's anything I can do to help, please let me know.
This phrase is good to use when a friend or acquaintance has bad news about an illness, a death in the family, money problems, etc. You can also ask "Is there anything I can do to help?" when you see someone working really hard and you don't have any work of your own to do.