Two functions are equal if and only if they have the exact same domain, and the exact value at each element of the domain. (If you like your functions to also have a specified codomain, then you also require the functions to have the exact same codomain).
“Cancelling” a common factor includes the implicit assertion that this common factor is not equal to $0$. So in your example, when you cancel $x-3$, you should also be saying under your breath “and $x\neq 3$”, so the correct simplification would be
that $\frac{x^2-9}{x-3}$ is equal to the function $x+3,\ x\neq 3$.
(So, yes, the function $f(x) = \frac{x^2-9}{x-3}$ and the function $g(x) = x+3$ are different functions, because they have different domain; on the other hand, $f(x)$ is equal to the function $h(x) = x+3$, $x\neq 3$. )
However, cancelling does not always lead to a different function. For example, the function
$$f(x) = \frac{x^2-5x+6}{x^2-6x+9}= \frac{(x-3)(x-2)}{(x-3)^2}$$
is equal to the function
$$g(x) = \frac{x-2}{x-3}$$
because they have the exact same domain (all $x\neq 3$), and take the same value at every point of the domain.
(This is similar to the fact that the function
$$f(x) = \frac{1}{\quad\frac{1}{x}\quad}$$
and the function $g(x) = x$ are different functions, because they have different domains.)