You can think about it in two ways, both following from Lopsy's hint. I'm not writing any new mathematics here, it's just a longer comment.
You can note that the function $f(x) = x^3$ is a homeomorphism of $\mathbb{R}$. Actually all you need is that it is injective, but using the fact that it is homeo one can show that the new metric leads to the same topology as the standard metric. Anyway - if one has a metric $d_Y$ on $Y$ and and injective function $g:X \to Y$ then the function $d_X:X\times X \to \mathbb{R}$ defined by $d_X(x,y) = d_Y(g(x), g(y))$ is a metric on $X$. It is an easy excercise and you don't have to worry about any special properties of the cubic function. In our case: $d_\mathbb{R}(x,y) = |x^3 - y^3|$ is taking the metric from $Y=f(\mathbb{R})$ to $X=\mathbb{R}$ with function $g=f$: $d_\mathbb{R}(x,y) = d_{f(\mathbb{R})}(f(x), f(y)),$ where $d_{f(\mathbb{R})}(a,b) = |a-b|$.
The second way - identical from the mathematical point of view but maybe useful for imagination - is looking at $d(x,y)$ as a metric on the graph of function $f$ defined as above. One projects the graph on the image and takes the metric from the image. It is important that the projection does not glue any points (because $f$ is injective).
Using this language - the first function $d(x,y)=|x^2-y^2|$ is not a metric because $f$ is not injective and glues $a$ and $-a$. When you thought about positive halfline then it was injective and everything was OK.