For real numbers $X$ and $Y$:
There are two regions in the $(x,y)$ plane and the formula for distance is different in the two regions (unless you use an absolute value, which is tricky to cope with in an integral).
The total region in $(x,y)$ space is $5 \times 5 = 25$ and the answer becomes
$$\frac1{25} \left( \int_{x=0}^5 \int _{y=0}^x (x-y) dy\,dx+ \int_{x=0}^5 \int _{y=x}^1 (y-x) dy\,dx\right)\\=
\frac1{25} \left( \int_{x=0}^5 \frac{x^2}{2}\,dx + \int_{x=0}^5 \frac{x^2}{2}\,dx \right)= \frac1{25} \int_{x=0}^5 x^2dx = \frac53
$$
For discrete integers:
There are $6\times 6=36$ possible combinations (pairs) of numbers and it would not be very difficult to write out the differences for each pair, add them up and divide by $36$.
I like to do this problem differently: Let person $A$ choose his number by rolling a fair 6-sided die and subtracting $1$ from th3e roll. Let person $B$ choose her number by rolling a six-sided die and subtracting the roll from $6$.
Then the (signed) difference between the two numbers chosen is equal to the sum of the two dice rolls, mius $7$. Since the distribution of the sum of two dice is $(P2\cdots 12) =\frac1{36}(1,2,3,4,5,6,5,4,3,2,1)$ the average distance is
$$
\frac1{36}(1\cdot 5+ 2\cdot 4+3\cdot 3 + 4\cdot 2 + 5\cdot 1 + 0 + 5\cdot 1 + 4\cdot 2 + 5\cdot 1 + 0 + 5\cdot 1 + 3\cdot+ 3 2\cdot 4+1\cdot 5) = \frac{70}{36}=1\,\frac{17}{18}
$$
This answer is a bit larger than $\frac53$ because more of the integer distributin is found at the very edge of the region.