I found the answer. Credit to @Tedinoz for helping me and for finding this link Google Apps Script to open a URL.
In this link 'TheMaster' provided an excellent answer. Two things are working here, an HTML source and a javascript. Within the HTML is var winRef = window.open(url1); which opens the URL in another tab, however a dialog box opens.
The next line shows
winRef ? google.script.host.close() : window.alert('Allow popup to redirect you to '+url1) ;
What this seems to do is closes the dialog box within google sheet, which appears to be this section
winRef ? google.script.host.close()
So in short, when setting this up name the HTML file whatever you want, with the Javascript, make sure line 6 on the javascript reflects the same name as the HTML source.
HtmlService.createHtmlOutputFromFile('openUrl').setHeight(50), // 'openUrl is the name of the HTML source, name this whatever.
Once done, go to your button, attach the script which you name it by the javascript function modalUrl.
Here is the full script. If 'TheMaster' ever sees this, please let me know if I nailed what I said above.
openUrl.html
<!DOCTYPE html>
<html>
<head>
<base target="_blank">
<script>
var url1 ='https://stackoverflow.com/a/54675103';
var winRef = window.open(url1);
winRef ? google.script.host.close() : window.alert('Allow popup to redirect you to '+url1) ;
window.onload=function(){document.getElementById('url').href = url1;}
</script>
</head>
<body>
Kindly allow pop ups</br>
Or <a id='url'>Click here </a>to continue!!!
</body>
</html>
code.gs
function modalUrl(){
SpreadsheetApp.getUi()
.showModalDialog(
HtmlService.createHtmlOutputFromFile('openUrl').setHeight(50),
'Opening StackOverflow'
)
}