I know that the answer to the following question should be out somewhere already, but I could not really find it, so if someone has a link I am happy to close this again.
I recently had to look back at the proof of separation of variables for some exercise I did, but I got stock with the proof of uniqueness:
Suppose we have the ODE
$$ x'(t) = f(x(t)), \ x(0) = x_0 $$
with $f(x_0) \neq 0$, $f$ continuos on $\mathbb{R}$. Then there exists some interval $I = (a,b)$ such that on $(a,b)$ the unique solution is given by $g^{-1}(t)$, with $$g(y) = \int_{x_0}^{y} \frac{1}{f(u)}du$$
Now to show that there exists some interval on which $g$ is well defined is easy, and then by the rules of differentiation one also gets that $g^{-1}(t)$ satisfies the ODE. However, for uniqueness the proof that I had learned is basically the same that is written down in this post.
I.e., one starts by observing that any hypothetical solution should satisfy
$$\frac{x'(t)}{f(x(t))} =1$$
and integrates this to show that the solution also has to satisfy $$ t = g(x(t))$$, which one then can invert on the given interval to show that indeed $x$ would have the correct form.
However, to make sense of the above fraction, one would need to know a priori that on some interval we have $f(x(t)) \neq 0$. Now of course by continuity for any solution we will have an interval where this holds , but how do we get an interval $(a,b)$ that works for any solution (which then ofc immediately gives uniqueness on that interval) ?
You are looking at it wrong. You do not need an interval $[a,b]$ that "works for any solution". What you need is for any solution an interval $[a,b]$ that works.
Because $f(x_0) \ne 0$ and $f$ is continuous, there is an interval $[c, d]$, containing $x_0$ in its interior, on which $f$ is non-zero. And by continuity $f$ is single-signed on $[c,d]$, which means that $g$ is strictly monotone and invertible on $[c,d]$, carrying it to some interval $[a, b]$. And inversely $g^{-1}$ carries $[a,b]$ to $[c,d]$.
Now let $x(t)$ be an arbitrary solution, extended to its maximal domain.. As $x$ is continuous, there is some maximal interval $[a', b']$ carried by $x$ into $[c,d]$. By the argument you've indicated, $x = g^{-1}$ on their common domain. But if $[a,b]$ is not a subset of $[a',b']$ then we can extend $x$ to the larger domain by making it equal to $g^{-1}$ there as well. Thus $x$ is defined and equal to $g^{-1}$ on all of $[a,b]$.
Therefore $g^{-1}$ is the unique solution inside $[a,b]$.