I like @Ted Shifrin's comment in the first answer below. To elaborate on it a bit, since $|x|=|x-0|=$(distance between $x$ and $0$), the expression you started with and your piecewise function both give $f(x)=|x|+|x-3|=$(distance between $x$ and $0$) + (distance between $x$ and $3$). If you think about this geometrically, the sum of these distances will always be greater than or equal to 3, with equality only when $0\leq x \leq 3$.
Here is a Desmos graph of $f(x)$.. It shows that all real numbers between 0 and 3 (including 0 and 3, all the fractions, . . .) are solutions to this equation (not just integers).
Algebraically, this is what your 2nd line is saying. $3=3$ here means "true" or "the equation you started with is true" as long as $0 < x < 3$. Your 1st line says that when $3 \leq x$ the equation you started with is true as long as $x=3$. Similarly, your 3rd line says that when $x \leq 0$ the equation you started with is true as long as $x=0$.