Vertically align text next to (not in) a table

You need to add option [t] to tabular for its position:

\documentclass{article}

\begin{document}
I want this text aligned to top:
\begin{tabular}[t]{lll} % <--- observe `t`
     1. & First step &\\
     2. & Second step &\\
     3. & Go back & Step 1\\\\
     \hline\\
     4. & Can't get here & Error.
\end{tabular}
\end{document}

enter image description here


As said by Zarko, the solution to that question is to use the key t of the environment {tabular} but, for information, I add this answer to show that with {NiceTabular} of nicematrix, there is also a key baseline to choice the row of the alignment.

\documentclass{article}

\usepackage{nicematrix}

\begin{document}
I want this text aligned to the second row:
\begin{NiceTabular}{lll}[baseline=2]
     1. & First step &\\
     2. & Second step &\\
     3. & Go back & Step 1\\\\
     \hline\\
     4. & Can't get here & Error.
\end{NiceTabular}
\end{document}

You need several compilations because nicematrix uses PGF/Tikz.

Output of the above code