Hanging leg raises can be a great exercise for your core, but they put a lot of stress on your lower back, especially if you're not engaging your abs correctly. One of the main issues I see with clients is that they tend to swing their legs or use momentum rather than focusing on controlled movements. If your back is screaming at you, you might be inadvertently using it to lift your legs instead of your abs. Make sure to keep your core engaged throughout the movement and try to focus on pulling your legs up rather than just lifting them.
If the pain persists, consider some variations that might be easier on your back. Try hanging knee raises first, which can help build strength without the full range of motion. Also, consider incorporating some exercises that strengthen your lower back like deadlifts and good mornings to support your core work. It's all about finding that balance and listening to your body.