The upright text you’re describing is the one in non-maths fonts.
Text in math mode should use text font is a pending issue.
#show math.equation: set text(font: "Fira Math")
// Using quotes -> upright Fira Math
$"Upright text" x + y = z$
// Using function `math.op` -> upright Fira Math with slightly less spacing
$op("Upright text") x + y = z$
// Using function `math.upright` -> upright Fira Math
$upright("Upright text") x + y = z$
// Using function `text` -> upright Fira Math
$text("Upright text") x + y = z$
// Using function `text` with own font -> own upright font
$text(font: "Libertinus Serif", "Upright text") x + y = z$
So you would want to use the last option, where Libertinus Serif is known to be the default outside font:
#let fun(arg) = $text(font: "Libertinus Serif", arg)_n$
// In code, use as any of the following
$fun("xyz") 1 + 1 = 2$
$#fun[xyz] 1 + 1 = 2$
$#fun([xyz]) 1 + 1 = 2$

Further automation might be possible throught context. That way, the outside font would be automatically applied.
Quick searches bring up these relevant posts:
