Allow the user to specify URLs in a configuration page.
As mentioned by wOxxOm, user-script manager e.g. TamperMonkey, GreaseMonkey, ViolentMonkey & FireMoneky (Firefox only), have user settings that users can enter, although that often requires some prior knowledge.
Set the @include to be very generic as https://.edu/ and use an if statement to determine we're on the user-specified URL using window.location.href before executing commands.
That is also possible (although inefficient) but may run into the same issues if the web site changes in such a way that would make the 'if statement' obsolete.
Is there any better way to do this?
Yes...script update system.
If the script is placed on an accessible server (GreasyFork, Github, etc) then an update URL can be set and then script can be automatically or manually updated by the users wherever it fails to function or an update is required.