This changes the length of the array, which can cause issues during the dispatch event loop, because it gets the length at the start. The index is also going to be off.

I think you need some sort of active check here too, mark the item as removed and then remove it once the dispatch look is done.

During the dispatch, check if a function is marked as removed, and if so, simply skip it for that loop. That way the loop size never changes and you can loop through forwards or backwards.