Using components of an Output as arguments of further calculation

In response of

Solve[x + y == 3 && x - y == -1, {x, y}];

I have found the output in the form

Out[1]:  {{x -> 1, y -> 2}}.

Now I have given a function

f[x_, y_] = x^2 + y^2 + 7

and want to find its value at the response point (x,y)=(1,2), how can one manage it without copying the values of x and y
The way
f[Out[1]] is not working …

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