Consider the cumulative distribution function of $X$, namely
$$
F(t)=\mathbb P(X\leq t).
$$
Your random variable can be described more precisely by starting with two independent and identically distributed random variables $X,Y$ and considering the conditional probability
$$
U=\mathbb P(X\leq Y\mid Y).
$$
By the tower property of conditional expectation, $\mathbb EU=\mathbb P(X\leq Y)$, which equals $\tfrac12$ since $\mathbb P(X=Y)=0$.
We extend this to higher moments of $U$ as follows. Let $X_1,X_2,\ldots,X_n,Y$ be independent and identically distributed. By independence,
$$
\mathbb P\bigl(X_1\leq Y,X_2\leq Y,\ldots, X_n\leq Y\bigm\vert Y\bigr)=U^n,
$$
and thus by the tower property
$$
\mathbb EU^n=\mathbb P(X_1\leq Y,X_2\leq Y,\ldots, X_n\leq Y)=\mathbb P\bigl(Y=\max(X_1,X_2,\ldots,X_n,Y)\bigr).
$$
Since $X_1,\ldots,X_n,Y$ are iid, each of them is equally likely to be the maximum and therefore
$$
\mathbb EU^n=\frac{1}{n+1}.
$$
Thus $U$ has the same moments as a uniformly distributed random variable on $[0,1]$. Since $U$ is supported in $[0,1]$ as well, it follows (by the uniqueness of the Hausdorff moment problem) that $U$ is uniformly distributed. Thus its probability density function equals $1$ inside $[0,1]$ and $0$ elsewhere.