If this happens on a consistent basis, then it should be easy to try safe mode. This will disable 3rd-party background software from running. If you don't have the problem in safe mode, then it is very likely the 3rd-party software causing the problem - probably some sort of networking monitoring software. https://support.apple.com/en-us/HT201262