This usually happens when you try to delete an item inside the for each loop. Error is thrown when you are modifying the collection that is being looped. To avoid this:
Instead of For Each loop, use “Exist in Collection” activity to check if the item exist in the list and store the result in a boolean variable
Using an If condition check with the boolean var = True then I’ve used an Invoke method to call the Remove method
pass the Target Obj as the List var and pass parameter - string being searched for
Hope this was helpful, please mark as solution if this resolves your problem.