If your question is, how to do it automatically, then the answer is: obviously no, you can't do it, because how on earth could you do it automatically?
If the question is just how to do it, then the answer is simple: you take every application you use
and notice keys and combinations that you use within those applications, and take care of defining new ones.
So generally you don't do anything special to avoid them, apart from just avoiding them.
By default, all AHK hotkeys are system-wide and "blocking". A running AHK script consumes the key event,
and prevents passing it further to the system (or any other app) and it is good so.
So at worst, you will lose ability to use this shortcut in some other application, and if you still need it there - then it is up to you how to resolve it, there is no single answer here.
One approach to keeping it all under control is to define application-specific hotkeys.
I.e. you can define a hotkey which is processed only when specific condition is met.
See https://autohotkey.com/docs/Hotkeys.htm#Context