And aside from its needed presence in the void loop() I have found that a sufficient “blocking” function or long processing routine can interfere with its ability to ‘answer’ the call from the IDE.
I have been able to mitigate that in situations like RGB lighting routines by adding a few ArduinoOTA.handle(); commands in strategic places of long running functions.