This question is from Hardy's book, which I'm working through. This isn't the usual $\epsilon-\delta$ question, where I can try to bound $x$ and $y$. I'm given the conditions for $\ f(x)$ instead, and from those conditions deduce how close $x$ and $y$ must be.
Right off the bat I can think of adding the two inequalities, arriving at
$$y^2-2 + 2-x^2 =y^2-x^2 = (y+x)(y-x) < 2\delta$$
So
$$(y+x)(y-x) < 2\delta$$
This gives a hint of what is needed, but I can't seem to proceed. Perhaps I'm missing something obvious. Another constraint that I know is $ (y+x)(y-x) < 4$, but again, I can't seem to make it work.

In my understanding, the exercise implies that both $x,y$, are values of some (positive) sequences which approximate $\sqrt{2}$, in the sense that they tend to limit $\sqrt{2}$ (by defect and by excess respectively). We might right $x_n,y_n$ to emphasize this, but it is not necessary.
Considering $0<\delta<2$, $$ 2-x^2<\delta \Leftrightarrow x^2-(2-\delta)>0 \Leftrightarrow \big(x-\sqrt{2-\delta}\big)\big(x+\sqrt{2-\delta}\big)>0 \Leftrightarrow \\ \\ x<-\sqrt{2-\delta} \textrm{ or } x>\sqrt{2-\delta} $$ Similarly $$ y^2-2<\delta \Leftrightarrow y^2-(2+\delta)<0 \Leftrightarrow \\ -\sqrt{2+\delta}<y<\sqrt{2+\delta} $$ Then, since $x,y$ are both positive and they are approximations to $\sqrt{2}$, by defect and by excess respectively, we have: $$ \sqrt{2}<y<\sqrt{2+\delta} \ \textrm{ and } \ \sqrt{2-\delta}<x<\sqrt{2} $$ and thus $$ x+y>\sqrt{2}+\sqrt{2-\delta}>2\sqrt{2-\delta} $$ Substituting in OP's inequality: $$ (y+x)(y-x) < 2\delta \Rightarrow \\ \\ \\ 2\sqrt{2-\delta}(y-x)<(y+x)(y-x) < 2\delta \Rightarrow \\ \\ \\ 2\sqrt{2-\delta}(y-x)< 2\delta \Rightarrow \\ \\ \\ \sqrt{2-\delta}(y-x)< \delta $$ Now, if $0<\delta<1$ (which seems a quite reasonable choice, although not specified in the question), the above gives (since $0<\delta<1\Rightarrow \sqrt{2-\delta}>1$): $$ y-x<\sqrt{2-\delta}(y-x)< \delta \Rightarrow \\ \\ \\ y-x< \delta $$