You can set multiple hyperlinks (as many as you wish) with this script (not by formula)
function multipleHyperLinks() {
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('A1').setRichTextValue(SpreadsheetApp.newRichTextValue()
.setText("go to ... stackoverflow")
.setLinkUrl(10, 23, "https://stackoverflow.com/search?tab=newest&q=google%20sheets")
.build());
};
RichTextValueBuilder
setLinkUrl(startOffset, endOffset, linkUrl)

By the way, if you want to retrieve all the links, use
function getMultipleLinks() {
var sh = SpreadsheetApp.getActive()
var rng = sh.getRange('A1')
var richTexts = rng.getRichTextValue().getRuns()
richTexts.forEach(function(richText){
Logger.log('|'+richText.getText() + '| = ' + richText.getLinkUrl())
})
}
edit
Here is an automatic solution based on onEdit(e) function :
Type in a cell : foo <link1|text1> foo <link2|text2> foo
for instance : go to ... <https://stackoverflow.com/|stackoverflow>
add 'Edit:' at the beginning to reverse
// mike.steelson
// example
// go to <https://stackoverflow.com/|stackoverflow> and <https://www.amazon.fr/|amazon> here
// add Edit: at the beginning to reverse
function onEdit(event){
var sh = event.source.getActiveSheet();
var rng = event.source.getActiveRange();
var value = rng.getValue()
if (value.substring(0,5).toLowerCase()=='edit:'){
var richTexts = rng.getRichTextValue().getRuns()
var txt=''
richTexts.forEach(function(richText){
if (richText.getLinkUrl()==null){
txt+=richText.getText()
}else{
txt+= '<' + richText.getLinkUrl() + '|' + richText.getText() + '>'
}
})
rng.setValue(txt)
} else {
var occ1 = ExtractAllRegex(value,'<([^>]+)>',0)
var occ2 = ExtractAllRegex(value,'>([^<]+)<',0)
occ2.push('')
if (sh.getName()=='mySheet' && occ1.length>0){
var richText = SpreadsheetApp.newRichTextValue()
var txt = value.split('<')[0]
for (var i=0; i<occ1.length; i++){
var arr = occ1[i].replace('<','').replace('>','').split('|')
txt += arr[1]
txt += occ2[i].replace('<','').replace('>','')
}
txt += value.split('>')[value.split('>').length-1]
richText.setText(txt)
var start = value.split('<')[0].length
for (var i=0; i<occ1.length; i++){
var arr = occ1[i].replace('<','').replace('>','').split('|')
var len = arr[1].length
richText.setLinkUrl(start,start+len,arr[0])
start += len + occ2[i].replace('<','').replace('>','').length
}
rng.setRichTextValue(richText.build())
}
}
}
function ExtractAllRegex(input, pattern,groupId) {
return Array.from(input.matchAll(new RegExp(pattern,'g')), x=>x[groupId]);
}