After detecting a GNU/Linux system through running
uname, in a GNU/Linux distribution
lsb_release -a is a good entry level utility you could use to [try to] find out the GNU/Linux distribution name and particular version1.
After detecting a Darwin (possibly macOS) system through running
uname, there must be a Different (maybe not that much...) way to Ask the OS version number1. Even if it only works on macOS, it'd be useful.
This is similar to the /etc/release for other Unix / Linux, but I’d like to specifically target macOS to script a check of the version. In what way(s) is this possible?