I don't like using the defaults system when getting this kind of thing, because in my experience it occasionally can hang for 1 (or more) seconds before returning a value.
Here's a macro that will run virtually instantly whether Safari is running or not.
if you can make due with the short version string then it's easier still using AppleScript.
--------------------------------------------------------
# Safari Short Version String
--------------------------------------------------------
tell application "Finder" to set safariAppAlias to ¬
(application file id "com.apple.Safari") as alias
tell application "System Events" to ¬
set safariShortVersion to short version of safariAppAlias
--------------------------------------------------------
# Google Chrome Short Version String
--------------------------------------------------------
tell application "Finder" to set chromeAppAlias to ¬
(application file id "com.google.Chrome") as alias
tell application "System Events" to ¬
set chromeShortVersion to short version of chromeAppAlias
--------------------------------------------------------
If the browser is running then we can get even simpler:
--------------------------------------------------------
tell application "Safari"
set shortVersionString to version
end tell
--------------------------------------------------------
tell application "Brave Browser"
set shortVersionString to version
end tell
--------------------------------------------------------
I believe you can retrieve the version of any application, regardless of whether it is scriptable or not, or whether it is running or not, by referencing it through its bundle identifier:
version of application id "com.apple.safari"
--> "12.1.1"
version of application id "com.google.chrome"
--> "75.0.3770.100"
I have been using a macro/script for several years now that will get the version of any app (including browsers) AND the macOS. It is very reliable and fast: