Hint: In order to compute an answer, you will have to make an assumption. One natural one is that $X$ and $Y$ are independent. Perhaps that was included in the question, and you forgot to mention it. Or perhaps it was (by mistake) left out.
Assuming independence, the pair $(X,Y)$ has uniform distribution on the square. So the joint density function is $1$ in the square, and $0$ outside.
The answer is then
where $A$ is the part of the square where $|x-y|<0.25$, or if you wish, $\le 0.25$, it makes no difference to the answer.
We can now do the integration, maybe by expressing our double integral as an iterated integral. But there is a much simpler way to solve the problem. We are integrating $1$ over $A$, so the result is the area of $A$.
Draw the region $A$ carefully. After you do that, you will not find it difficult to find its area. No integration, just basic geometry.
Remark: To see that we need some sort of assumption about $X$ and $Y$, let $X$ be uniformly distributed on $(0,1)$, and let $Y=X$. Then $X$ and $Y$ satisfy the conditions of the problem as stated, but are very much not independent. It is clear that $P(|X-Y|<0.25)=1$.