It's designed to solve exactly this problem, and has been universally available since 2020.
The most likely scenario for `globalThis` to fail is if the user is stuck with an old browser, in which case `self` will be available. `window` will be too, but `self` also works in web workers.