Let $k$ be an algebraically closed field, ad take $X=\mathbb{P}^2_k$, $U=\mathbb{A}^2_k$.
Then $X$ and $U$ are not homeomorphic, since $U$ contains two disjoint, Zariski-closed, irreducible subsets made of more than one point (think of two parallel lines), but this is not possible in $X$ because of Bézout theorem.