Why are work and energy considered different in physics when the units are the same?

One definition of work is "a change in energy." Any change in a physical quantity must have the same units as that quantity.

Different kinds of work are associated with different kinds of energy: conservative work is associated with potential energy, non-conservative work with mechanical energy, and total work with kinetic energy. In fact, that's one way to see the oft-quoted Law of Conservation of Energy:

$$ W_{total}=W_{non-conservative}+W_{conservative}\\ \Delta KE=\Delta E - \Delta PE \\ \therefore \Delta E=\Delta KE + \Delta PE $$

So just like impulse (which is a change in momentum) has the same units as momentum, work has the same units as energy. Any change in a physical quantity must have the same units as that quantity. A change in velocity has units of velocity, etc.

A more difficult question might be why torque has the same units as energy. This is more subtle, but the key concept is this: units are not the only thing that determines a quantity's interpretation. Context matters too. Energy and torque may have the same units, but they are very different things and would never be confused for one another because they appear in very different contexts.

One cannot blindly look at the units of a quantity and know what is being discussed. A dimensionful quantity might be meaningless or meaningful depending on the context, and it's meaning can change with that context. Action times speed divided by length has the same units as energy but without any meaningful interpretation (as far as I'm aware).

Perhaps a better analogy than height and width can be found in terms of money. Both the balance in your bank account and amount you pay for, say, your electricity bill are denominated in the same units (dollars where I live), but they represent separate concepts. One is measure of what is stored and the other is a measure of what is transferred.

In most uses 'energy' means an amount available in some system (like the balance in an account) while work and heat represent transfers (like payments).

The analogy can be pushed too far as we often don't care about absolute level of energy and treat negative balances in exactly the same way as positive one while your bank may take a dim view of your maintaining a negative balance.

Work and energy are in fact different things, but they are closely related. So closely that they share the same units. To understand the difference between them and why this difference does not imply new units, let me borrow a story told by Feynman in his Lectures on Physics and improved by Van Ness in his Understanding Thermodynamics.

Let us imagine a boy living in a house with his mother and 37 indestructible small cubes. The house has two windows labeled by $W$ and $Q$. Every day the mother counts the cubes and some day she finds only 35. The boy does not say where are the two missing cubes but the mother notice that they can be inside a box which (by some reason) she cannot open. She weights the box, wait until another day when she counts 37 cubes, weights the box again, takes the difference between the readings and divide it by the weight of one cube. She finds out that the two cubes missing the other day were inside the box. Another day she counts only 30 cubes. She weights the box again, does the math and notice there are still 3 cubes missing. She realizes that those missing cubes can be on the bathtub. She cannot either see or check with is hands because the water is dirty. She measure the level that day and in another day when there is no cube missing, does the math and can now account for blocks in the bathtub. She has a formula able to account for blocks eventually hidden in the box and in the bathtub: $$37=\mathrm{visible\ cubes}+\frac{\mathrm{weight\ box}-\mathrm{weight\ empty\ box}}{\mathrm{weight\ one\ cube}}+\frac{\mathrm{level\ bathtub}-\mathrm{level\ bathtube\ with\ no\ cube}}{\mathrm{change\ of\ level\ due\ to\ one\ cube}}.$$

One day however she checks the box and the bathtub but she cannot find 37 cubes. Some day she finds even 40 cubes! The only conclusion is that there are cubes being thrown in and out the windows. She came up with another formula: $$\mathrm{number\ cubes}-37=Q+W$$ where $Q$ and $W$ denotes the number of cubes that crosses the windows $Q$ and $W$. If the cube comes in, the number is positive, if the cube is thrown out, the number is negative.

So, the first equation is a conservation law and the 37 cubes metaphorically represents energy. The three terms on the right means different ways energy (cubes) can show up. It could represent, for instance, kinetic energy, rest mass energy, the different potential energies. All with the same units. The second equation represents a way of accounting for energy (cubes) entering and living the system (the house) via heat (window Q) or work (window W). Again, all the terms in that equation has the same units. That formula actually represents the first law of thermodynamics and $W$ stands for work. As you can see, work is the term given for energy that enters or leaves the system in a given way (window W), namely, through ordered motion. On the other hand, heat denotes the energy entering or leaving the system disorderly (window Q). Thus, by its very own construction, work has to be the same units as the energy of the system, even though they are different things.