Where is the mistake? Finding an equation for the ellipse with foci $(1,2)$, $(3,4)$, and sum of distance to the foci equals to $5$. 
Find an equation for the ellipse with foci $(1,2)$, $(3,4)$, and sum of distance to the foci equals to $5$.

We consider the foci in the coordinate system $XY$ such that $X=x-2$ and $Y=y-1-x$, the coordinates of the foci in this system are $(-1,0)$ and $(1,0)$, furthermore $2a=5$, the equation of the ellipse in $XY$ is
\begin{equation}
\left( \frac{X}{2.5}\right)^2 + \left( \frac{Y}{\sqrt{5.25}} \right)^2 = 1
\end{equation}
and this can be expressed in $xy$ as
$$\left( \frac{x-2}{2.5} \right) + \left( \frac{y-1-x}{\sqrt{5.25}}\right) = 1$$
I have made the graph of the last equation and it is not the case that foci are $(1,2)$ and $(3,4)$, so, can anyone help me to see the mistake please?

As shown in other answer, you can just form an equation for sum of distances to foci. Going by your method, the goal would be to write
$$\left( \frac{\text{Distance from Line perp to Axis, thro' center }}{\text{Semi-major axis}} \right)^2 + \left( \frac{\text{Distance from Axis}}{\text{Semi-minor axis}} \right)^2 = 1$$
which are proper substitutes for $X,Y$ in the standard form.

*

*Axis is the line passing through foci : $y=x+1$

*Center of ellipse is midpoint of foci : $(2,3)$

*Line perpendicular to axis and passing through center $(2,3)$ is $x+y=5$

*You can calculate semi-major axis $=a$ and semi-minor axis $=b$.

Then required equation of ellipse is
$$\frac{1}{a^2}\left( \frac{x+y-5}{\sqrt{2}} \right)^2 + \frac{1}{b^2}\left( \frac{x-y+1}{\sqrt{2}} \right)^2 = 1$$
This simplifies to $$84x^2 -32xy + 84y^2 + \cdots = 0$$
