Using automator make an app that runs this applescript:
on run {input, parameters}
set targetURL to "https://example.com" -- Replace with your desired URL
tell application "Safari"
activate
set windowList to windows
set windowFound to false
repeat with currentWindow in windowList
if (URL of current tab of currentWindow) contains targetURL then
set index of currentWindow to 1 -- Bring the window to the front
set windowFound to true
exit repeat
end if
end repeat
if not windowFound then
-- No window with the URL found, create a new one
make new document with properties {URL:targetURL}
end if
end tell
return input
end run
Change the URL, and save it as an application, and add that application to the dock.
This will automatically detect a window you already have open with the URL and activate it instead.