Let me give an example. Let \mathbb{Q} be the rational numbers. Let's define the following "function":
f\left(\frac{m}{n}\right)=\frac{m+1}{n+1}
At the first sight, there is not really a problem. But let's look deeper. We have
f\left(\frac{1}{2}\right)=\frac{2}{3}
and
f\left(\frac{2}{4}\right)=\frac{3}{5}
But, as we know, the numbers 1/2 and 2/4 are equal, but the numbers 2/3 and 3/5 are not equal. So the function f sends 1/2 to two different values: 2/3 and 3/5.
However, a function is defined as sending a value in the domain to a UNIQUE value in the codomain. Here, we have sent 1/2 to two different numbers, which means that f is not a function. We usually say that ''f is not well-defined'' (I don't think the expression is really formally correct, but it is used everywhere).
Another way a function could not be well-defined is that it send something to a value not in the codomain. For example: f(x)=\sqrt{x} is not well-defined if the domain and codomain are both \mathbb{R}. Indeed, \sqrt{-1} is not in the codomain.
So, if you are given a ''function'', you should always check if a value is being sent to a single other value, and not to multiple values. Furthermore, the value should be in the codomain. Knowing when this is a problem requires a bit of experience, but the problem arises usually in things like ''quotients''.