Acidity
It’s a weird little trope, worms in fruit being drawn as earth-worms and not fruit-fly maggots or whatever.
Also, I asked Dr. Karl if acidity really would hurt a worm but he ignored me so lets all suspend our disbelief today. No don’t be frightened – I’ll go first.