I'm not sure how I feel about my friend doing something illegal
Why do you feel this way about your friend?
They shouldn't be doing something illegal. They shouldn't get in trouble
Instead of intentionally getting your friend in trouble, should take the time to convince them not to do the thing that would be problematic.
If they get in trouble, I'll help them since they're my friend.
I'm glad that you have decided to help them. It's always good to help out a friend when they are in trouble.