I have difficulties understanding the proof given below showing that there exist 2 distinct vertices $u,v$ in $G$ such that $d(u) = d(v)$ where $G$ is a non-trivial graph.
Proof: It's clear that $0 \leq d(x) \leq n-1$ for each $x \in G$. If the above statement is false, then there exist 2 vertices $y$ and $z$ in $G$ such that $d(y) = 0$ and $d(z)=n-1$, which however is impossible.
I'm not sure how they deduce from the falsity of $0 \leq d(x) \leq n-1$ that there exist 2 vertices $y$ and $z$ in $G$ such that $d(y) = 0$ and $d(z)=n-1$.
That isn't the statement they are assuming to be false. Rather, they are assuming that $d(u)\ne d(v)$ for every distinct pair of vertices $u,v$ of $G.$ Since there are $n$ vertices of $G$ and $n$ distinct possible values of $d,$ then in particular, $d$ obtains the values $0$ and $n-1$ at some vertices of $G,$ say $u$ and $v$ respectively. Since $d(u)=0,$ then $u$ isn't adjacent to any of the other vertices of $G,$ and in particular, isn't adjacent to $v.$ Since $d(v)=n-1,$ then $v$ is adjacent to every other vertex of $G,$ and in particular, is adjacent to $u.$ Therein lies the contradiction.