Hi and
to the forum.
It might be a simple case of adjusting the travel on the derailleur itself to prevent it going too far towards the hub.
If necessary, a spacer washer
(sometimes supplied) can be fitted between the freewheel and the hub to give more clearance, but you must then make sure there is still enough space between the freewheel and the frame.
Alan