My 5.5yo struggles with this too - I have been trying to work on it with him recently.
What you're doing already is really great.
What I would add to it is have a think and see if you can notice any patterns e.g. is it harder for her to share vs easier for her to share in certain situations? Times of day? And when she's in a "sharing and kindness is easy" sort of mood, what clues can you see about her body language? When she's in a snatching, reactive, impatient mood, what clues can you see about her body language?
My guess is (from what I've observed with my DS plus things I've learned recently) you might notice this:
Sharing, kind, generous, patient =
Body is relaxed, voice is low and calm, movements are slower, facial expression neutral-ish, her laugh seems natural, if you ask her something she likely responds.
Snatching, mean, impatient, reactive =
Body is tense (if you touch her to try and calm her or direct her movement), movements are fast and frantic, voice is high or loud or harsh, facial expression may be angry or almost a "manic" kind of smile, her laugh seems unkind or "too much", liable to respond with nonsense or a more defiant type of retort if you try to speak to her.
What can happen when children can seem to manage something sometimes, but not all the time, is that it's a sign something is going on underneath.
For DS when I notice he is getting into this sort of state I can run through a sort of mental checklist (a bit like "why is the baby crying?" checklist).
Is he hungry? Thirsty?
Does he need a wee or a poo and been putting it off?
Have we been outside today?
Have I spent some one on one time with him today?
Is he tired, coming down with something?
Is something causing a strong emotion? E.g. anxiety about other child's actions. Sadness because parent is currently working away. Discomfort from clothing. Frustration because the task is too difficult.
Children of this age can be a bit behind in their development of interoception - a fancy word for the internal sensations in the body - so they don't always notice when they feel hungry or irritated or need a wee etc, and this associated discomfort can cause their capacity for other skills like empathy, impulse control, listening etc to be a bit dampened. If this is the problem, you can increase frequency of things like meals so it's little and often, and do more prompting for toilet visits. Try and encourage her to check in with her body and think about whether she needs anything. (I printed off a version of the checklist for DS to look at actually).
Or another common cause of social problems is when they are a bit behind in their communication, which could be anything from speech delay (checklist for age 4) to hearing problems, to difficulty understanding non-verbal cues, which causes anxiety because they can't easily predict the behaviour of other children and they often jump to the conclusion they are scared of (he's going to break it!)
Or it could be impulse control in general - but if it was this I think it wouldn't just be this area - you'd be seeing other behaviours like hyperactivity, risk taking, difficulty following adult instructions etc.
Anyway. My DS has problems with all of these things but he is a bit older so it's more unusual that he struggles with these skills. As she's only four, it is more likely that it's just one or two things that are feeding into this difficulty for her and it is something she'll outgrow. You can definitely help her in the short term.
Something which has been really helpful for us is helping DS to slow down and observe rather than immediately reacting. So, when his 2.5yo brother is having a turn with something and the 5.5yo wants it, I bring him over to me (sometimes this is not really his choice and he fights it a little bit) but he sits on my lap and I say "Look. Let's watch DS3. He is going to get bored of that in a minute. Let's see if we can wait for ten minutes. I'll help you wait. What shall we do while we wait?" If the TV is on, I might talk about what's happening there. Or invite him to choose a book to read. He has half an eye on DS3 the whole time and he's probably itching to get off my lap, because his whole entire body is willing him to go and snatch the toy that he wants so much. Because in the past, he has had the experience that waiting does not work (because he doesn't wait long enough) and that snatching does work (because if a grown up doesn't intervene, then he can easily overpower DS3 and get the toy). So the point of this is to build in lots of successful waiting experiences and show him that, actually, he CAN wait longer.
We almost always find that 10 minutes is enough for the 2.5yo to get bored of the item. In fact, the 2yo often voluntarily comes and gives the item to the 5yo. Though honestly, just as often he will literally abandon it on the floor as his own attention shifts. As soon as I'm sure it's been actually finished with, I praise DS2 for waiting (even if he hasn't been especially patient, the point is that he did not snatch, even if he only didn't snatch because I was holding him away from arm's reach) and he's free to have the toy.
Some other things we are working on, adjacent to this are - determining whether DS3 has ACTUALLY finished with the item or if he has just put it down for a moment but is still playing with it, understanding the difference (otherwise, DS2 will gleefully snatch up the "abandoned" item thinking that he has done the right thing and DS3 will be upset anyway. DS2 is then upset if you take it off him because he genuinely thought that it counted as DS3 being finished).
And when DS2 has the item that DS3 wants, DS2 has the tendency not to give it to him but to grasp it tighter and almost hoard it, even if he's not actually playing with it. So again, reminding DS2 that DS3 will get bored of the toy very quickly, and encouraging him to give it to him with the knowledge that it's not forever. I think in these situations, DS2 gets caught up in the fear that DS3 might take the item and not give it back.
Or, if it really is fair that it's DS2's turn, encouraging DS2 to find a similar/alternative item for DS3, and if this is too difficult (because DS2 has something underlying I can't immediately fix, or because it's something highly valued like this old phone we let them play games on sometimes) then an adult will engage DS3 in finding an alternative or separate play space.
Sometimes when they are playing together (e.g. both with the train track) they can share and collaborate well together. But if they are having a hard time with this then we find it helps if an adult sits right beside DS2 and does a combination of "downloading calm" (basically being very calm and grounded ourselves, not going into fear about him being a brat, not going into irritation, modelling deep breathing, maybe providing calming input like a steady hand on his back, arm/back strokes, talking with a deliberately slow and quiet and calm tone) and doing that slow-down-and-observe thing.
So DS3 will grab a piece of track that I know DS2 wanted to use. I remind him "Don't worry. DS3 will put that down in a minute. Let's build this part instead while we wait." Sure enough DS3 puts the piece of track in a random location and in 30 seconds has moved on to something else and doesn't notice when I move that track back to DS2's preferred location. Or DS3 wants to drive trains around the track which is unfinished. DS2 does not want this. I remind him "Don't worry, he's testing that part. When he gets to this part, we can put a red traffic light here. This part is closed for maintenance!" Basically, the problem here is that DS2 wants DS3 to do exactly what DS2 has in mind. And DS3, being 2, sometimes finds following instructions easy and sometimes he does his own thing (parallel play). But DS2, being 5 (and a bit socially delayed) doesn't understand that and gets frustrated, or anxious that DS3 will "mess everything up". He just needs more experiences of DS3 behaving in an unpredictable way and that being OK (or even fun), which he needs a bit of support with. And I think this will also dissipate as DS3 gets older and more able to play collaboratively, as he does when he's in a more cooperative mood. It's also easier for him to relax knowing that an adult will prevent DS3 from totally destroying the track, whether from play, malice or accident.