In highschool I've always been taught the dimensions on the left hand side of the equation should always be equal to the dimensions of the right hand side, because we can't compare apples and oranges so to speak.
Eg: $5 g = 5 g$ is valid but $5 m = 5 g$ is not.
I haven't given this much thought, until recently a friend of mine came up with this question: "Since $e = mc^2$, and since $c$ is just a constant: doesn't that mean that energy is just mass with another unit?"
Is this wrong usage of dimensions in equations? If not then what is the real meaning of dimensions and units within equations?
I am not allowed to leave a comment but I think this is an important point regarding your question: Particle physicists actually use the electronvolt ($eV$), which is a unit of energy, as a unit of mass, because mass and energy are equivalent. They are using a natural unit system where they define $c=1$. It should be noted, however, that one may not just choose arbitrary constants and declare that they are equal to one, because that might result in contradictory definitions, see e.g. the fine-structure constant. In fact, natural unit systems are much like what you do whenever you run a physics simulation on a computer: you must store the values of the physical quantities as dimensionless values in the computer memory and keep track of the dimensions in another way.