Edit: Removed specific equation.
General question is: How are variables and functions treated differently during differentiation?
Edit: Removed specific equation.
General question is: How are variables and functions treated differently during differentiation?
You may be right or wrong, depending on what $y$ means in the context.
If $y$ is a function of $x$, let us write it explicitly $y(x)$, then:
$$\frac{d}{dx}(x-y(x))^3=3(x-y(x))^2\left(1-\frac{dy}{dx}\right)$$
If $x$ and $y$ are independent variables, and you are only differentiating on $x$, then you are treating $y$ as a constant during differentiation. However, then this is called partial differentiation and you should've used the symbol $\frac{\partial}{\partial x}$:
$$\frac{\partial}{\partial x}(x-y)^3=3(x-y)^2$$
because when differentiating $x-y$ on $x$ only, the derivative of $x$ is $1$ and the derivative of the (constant) $y$ is $0$.