The following works as expected:
\documentclass{minimal}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\makeatletter
\node (01) at (0, 0) {};
\draw (0, 0) -- (0, 01);
\makeatother
\end{tikzpicture}
\end{document}
But when I replace one of the 01s with \@ifnextchar1001, which should be equivalent according to my understanding, it breaks:
\documentclass{minimal}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\makeatletter
\node (\@ifnextchar1001) at (0, 0) {};
\makeatother
\end{tikzpicture}
\end{document}
gives
! Argument of \XC@definec@lor has an extra }. <inserted text> \par l.6 \node (\@ifnextchar1001) at (0, 0) {};
and
\documentclass{minimal}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\makeatletter
\draw (0, 0) -- (0, \@ifnextchar1001);
\makeatother
\end{tikzpicture}
\end{document}
yields
! Argument of \XC@definec@lor has an extra }. <inserted text> \par l.6 \draw (0, 0) -- (0, \@ifnextchar1001) ;
What is the relevant difference between 01 and \@ifnextchar1001 in this case?
How can I make this – or a similar construct – work as intended?

XC@prefix suggests that the problem might stem from withinxcolor. Hence the color tag. – Hermann Döppes Jan 22 '17 at 01:45\begin{document}. It is good practice to make sure the cat codes are what LaTeX expects when that stuff gets executed. Hence, if you change them in the preamble, you change them back. If you change them in the document, you change them back before\end{document}. But you shouldn't usually change them in the document directly, of course. – cfr Jan 22 '17 at 04:139:50instead of09:50, so this is really not about the original problem.) – Hermann Döppes Jan 22 '17 at 04:20\numberis what you need. Can you please tell what's the expected result? – egreg Jan 22 '17 at 09:23\@ifnextchar1001is not the best way to explain the problem you have. Yes, the ultimate reason is that\futureletis involved, but that's all. – egreg Jan 22 '17 at 09:34