The easiest way:
Solve[x + y == 3 && x - y == -1, {x, y}]
x^2 + y^2 + 7 /. %
Another way:
sol = Solve[x + y == 3 && x - y == -1, {x, y}]
f[x_, y_] := x^2 + y^2 + 7
f[x, y] /. sol[[1]]
In general, Solve
gives the solutions in the form of replacement rules, that can be used with the /. mechanism. Haave a look at the documentation for Solve in the Scope > Basic Uses section.
With SolveValues
there are no replacement rules and the procedure is different:
sol2 = First@SolveValues[x + y == 3 && x - y == -1, {x, y}]
f[x_, y_] := x^2 + y^2 + 7
f @@ sol2