When simplifying algebraic expressions, we often "cancel out" common factors in the numerator and the denominator. However, this is based on the assumption that these factors are not zero.
So, you are correct.
We should not cancel out blindly. It should depend a bit on the context as well.
For example:
If we are solving quadratic equations, it's always better not to cancel.
I have landed in trouble on a lot of questions as I cancelled out where I should not have cancelled anything.
but if the problem explicitly states that a ≠ 3, we can cancel out that term.
If nothing is stated,
a can be equal to 3,
or
a can be any other number,
we cannot cancel it.
(I'm not an expert, so let me know if there are any errors in my explanation)