I need to prove that $[0,1]$ is connected, and one of the steps indicated is to let $c:=\sup\{t\in [0,1]:[0,t]\subseteq U\}$, where $U$ is a set which is relatively open in $[0,1]$. But is it even valid to define $c$ in such a way? This definition assumes that $\exists$ a real number which is immediately less than $\sup\{U\}$, that is immediately preceding $\sup\{U\}$, which is impossible due to the density of reals!
Would appreciate an explanation.
Henno Brandsma's answer is excellent and addresses the question as stated. Let me address what seems to be the root of your confusion as written in the comments:
This is incorrect. Let us write $A=\{t\in[0,1]:[0,t]\subseteq U\}$. Then $\sup A$ is not necessarily an element of $A$. It is just the smallest number that is greater than or equal to every element of $A$. For instance, if $U=[0,1/2)$, then $A=[0,1/2)$ as well, and $\sup A=1/2$, which is not actually an element of $A$. So the interval $[0,\sup A]$ is not necessarily contained in $U$, and the existence of $\sup A$ does not mean there is a largest interval $[0,t]$ contained in $U$.