You've had some very unhelpful replies considering you've come here to say "I don't know what to do, please help".
It's hard.
Their brains are still developing, their pre-frontal cortex isn't there yet but at that age they're still juggling all sorts of social issues, big feelings, expectations of them are higher, and they just can't process things well yet. Sometimes they're hangry and it escalates or tired and it comes out as anger.
What helps? In the long run but not in the moment when she kicks off, this is the stuff that can help: Routines, having good quality sleep and a balanced diet low in UPFs, having a good handle on energy levels - so making sure there's time to rest and time to move around/exercise/play, there's also work you can do around giving her the emotional vocabulary and understanding so you can better talk about how she's feeling.
I'm not an expert, I'm just trying to remember what the educational psychologist who's worked with our school has told us (I'm not a teacher!)
What you can do when she's actually being rude or shouting or in wound up state: be calm - I know it's so so so bloody hard when you're also stressed or angry or frustrated but in that moment you've got to suck it up buttercup and help to de-escalate not to add more chaos and anger and volume. Step back and make room - not the naughty step where she'd feel punished and abandoned but just giving some space, not crowding her (obvs this is easier at home). Sometimes breathing exercises or calming techniques can help if you've talked about using them calmly before the moment - you can use these too - like breathing in for a certain count and breathing out for a certain count. It helps to remove the panic and becomes more about soothing so you can get to the root of the issue rather than making a bigger deal about it. Validate her - "I can see you're upset" "I can see that you're frustrated" "I understand that you're annoyed about this" - she'll feel heard - it's so frustrating if you're hurt or cross about something and the other person doesn't even take that on board. "I know this is hard, let's find a better way to do it" or "I know you don't enjoy this thing, we can do it together". Arbitrary punishment when she's at a peak of being cross and wound up is just going add layer upon layer of anger and frustration and can escalate her distress. Of course, it's not OK for her to be rude to you or to use hurtful language or to lash out, but you can only properly talk about that afterwards when it's all de-escalated.
Talk with school, talk with her class teacher, say you know she doesn't behave like this in school but you're struggling at home and you'd like some advice and some signposting so you can feel more prepared and hopeful.
My step daughter was challenging for me in the last few years of primary school - it was a mix of above with some added hormones thrown in. It was usually when we were trying to get out of the house to school drop offs. I tried my best to keep things calm, keep us on schedule, make sure her and her younger siblings all were washed and dressed and fed and deposited at their separate schools and nursery. One thing I introduced was an early morning dog walk after dropping one child to breakfast club, so she'd get a walk, fresh air, and a calmer chat with just me and the baby and the dog before we headed off to her school, that way she was better regulated before going in to see her friends and teacher and I had a better morning and we were able to have a positive start even if she'd had an earlier meltdown about her plaits being too wonky or not wanting to brush her teeth or whatever. It didn't stop those moments completely but it stopped our whole morning routine being overshadowed by those moments. To facilitate that extra 20-30 min walk, I'd shower the night before and get the breakfast table set out before going to bed and do the breakfast washing up after the school run.
She's a lovely adult and was a lovely teenager. We don't have any shouting now. Neither of my sons were ever like it as kids or teens but I think she had a lot more to deal with at 8 than they did.