The 'source' command is not available in the default sh shell on Linux. The source command is specific to bash and other compatible shells. On Linux, the default sh shell is often dash, which does not support source. It seem to work on macOS because the default shell there is bash.
The . (dot) command is POSIX-compliant and works in both sh and bash.