Notice that triangles XYZ and WYZ are congruent because of the SAS postulate.
Then,

Because the pairs of corresponding sides are XZ-ZW and XY-YW.
Therefore, we cannot conclude that

On the other hand, the algebra used by Lydia has no mistakes.

So, Lydia is incorrect when setting the equation, the algebraical operations are correct.
The two valid equations are:

We can even combine both equations and obtain

The answer is:
Lydia is wrong because the initial equation is false. The two possible equations are 5x-5=3x+9 or 4x+6=5x-1.