I solved $\sqrt{2x+1}-\sqrt{2x-1}=2$ by squaring both sides.
$$\sqrt{2x+1}=\sqrt{2x-1}+2$$ $$2x+1=(2x-1)+4\sqrt{2x-1}+4$$ $$-1=2\sqrt{2x-1}$$ $$1=4({2x-1})$$ $$x=\frac{5}{8}$$
Now when I put $x=\frac{5}{8}$ to the given equation,I get $\sqrt{\frac{5}{4}+1}-\sqrt{\frac{5}{4}-1}=1 \neq 2$
What am I missing ?


Your re-arranged equation $ \ \sqrt{2x+1} \ = \ \sqrt{2x-1} \ + \ 2 \ \ $ would give the $ \ x-$coordinates for the intersection points between two square-root curves, if such points exist. However, "squaring" this equation reveals a difficulty. The curve equation $ \ y^2 \ = \ 2x + 1 \ \ $ implied by the left side represents a "horizontal" parabola "opening to the right" from the vertex $ \ \left( \ -\frac12 \ , \ 0 \ \right) \ \ , $ for which $ \ y \ = \ \sqrt{2x + 1} \ $ is the "upper arm" of the parabola [violet curve in the graph below] and $ \ y \ = \ -\sqrt{2x + 1} \ $ is the "lower arm" [red curve]. On the right side of the squared equation, the curve equation would be $ \ (y - 2)^2 \ = \ 2x - 1 \ \ , $ a horizontal parabola which also "opens to the right" and has the vertex $ \ \left( \ +\frac12 \ , \ \mathbf{2} \ \right) \ \ , $ The original square-root curve $ \ y \ = \ 2 + \sqrt{2x - 1} \ $ is the upper arm [blue curve] of this parabola; at $ \ x \ = \ \frac12 \ , $ the square-root curve function $ \ y \ = \ \sqrt{2x + 1} \ $ has only attained the value $ \ \sqrt2 \ \ , $ so it does not meet $ \ y \ = \ 2 + \sqrt{2x - 1} \ $ and always remains "below" this latter curve thereafter.
However, the lower arm of that parabola [orange curve], which is the square-root function $ \ y \ = \ 2 - \sqrt{2x - 1} \ $ does intersect $ \ y \ = \ \sqrt{2x + 1} \ $ at $ \ x \ = \ \frac58 \ \ , $ as you found. $ [ \ \sqrt{2·\frac58 + 1} \ = \ \sqrt{\frac94} \ = \ \frac32 \ = \ 2 - \sqrt{2·\frac58 - 1} \ = \ 2 - \sqrt{\frac14} \ = \ 2 - \frac12 \ \ . \ ] $
The parabolas "generated" by the "squared equation" have an intersection point, but since square-roots of real numbers are always taken to be non-negative, we "reject" the intersection with the "negative-of-square-root arm" of one of those parabolas. This leaves no (real-valued) solutions to the original equation.