How can I fix intermittently not being able to switch between the same application windows via shortcuts? Command + ` intermittently stops working sometimes. There's no obvious pattern I have noticed it in both finder and in chrome. The windows are not minimised because I can move the current one and clearly see the one behind it. After a while it goes back.

It happens about 1-2 times a day. Any ideas?
Quoting form Apple's Human Interface Guidelines for developers:


  Users can view all of an app’s open windows by activating App Exposé. In App Exposé view, users can choose one of the open windows on the current desktop or scroll to find an open window on a different desktop. Users can also cycle forward or backward through an app’s open windows on the current desktop by using Command-Backquote and Command-Shift-Backquote. If full keyboard access is on, they can cycle through all windows by using Control-F4 and Shift-Control-F4.


As it relates to your question, it is important to point out that the above quote from the HIG talks about cycling through "open windows on the current desktop". I presume that excludes windows that have been minimized to the dock. That may explain some of the inconsistencies that you see. 

The takeaway here is that while the OS may try to standardize certain keyboard shortcuts, this only work if each app developer  implements their app using standard AppKit controls. The less standard the controls look (like Chrome), it is likely that the standard keyboard shortcuts will not function as you expect. 

As a side note, even within apps that do use AppKit, they may implement certain shortchuts like tab-switching in a different way. Hope this helps.