For good measure, a LuaLaTeX-based solution. :-)

% !TEX TS-program = lualatex
\documentclass{article}
\usepackage{luacode} % for '\luaexec' macro
\luaexec{ function series ( s )
return ( s:gsub ( "[\%s]+" , "\\hspace{0.16666em}" ) )
end }
\newcommand\series[1]{\directlua{tex.sprint(series("#1"))}}
\begin{document}
2001, 2002, 2005, 2022
\series{2001, 2002, 2005, 2022} % replace space with breakable thinspace
\end{document}
Addendum: Just for completeness (and maybe to make @wipet's day too...), here's a solution that makes the Lua function series work with both LaTeX and PlainTeX. I'm not posting an associated screenshot as the output is the same as what's shown above.
% !TEX TS-program = lualatex
\documentclass{article}
\directlua{ function series ( s )
return ( s:gsub ( "[\csstring\%s]+" , "\string\\hskip0.16666em\string\\relax" ) )
end }
\newcommand\series[1]{\directlua{tex.sprint(series("#1"))}}
\begin{document}
2001, 2002, 2005, 2022
\series{2001, 2002, 2005, 2022}
\end{document}
\\hspace{0.16666em}by\string\\hskip0.16666em\string\\relaxand\luaexecby\directluathen your Lua function becomes independent of LaTeX. – wipet Jan 25 '23 at 06:40\luaexecinstead of\directluain the answer shown above is that\luaexeclets me easily "smuggle" a%symbol over to the Lua side. (I need the%symbol in the pattern-matching expression[%s]+, which produces a pattern match for one-or-more instances of%s, Lua's "magic" character for whitespace.) Of course, I could use\directluaif I first replaced\%with\percentchar, where the latter could be defined via, say, \begingroup\catcode`%=12\relax\gdef\percentchar{%}\endgroup. I'll post an addendum... – Mico Jan 25 '23 at 06:57\%problem because the\%is a expandable macro which expands to%in my macro package. I can use simply\%in\directlua. Plain TeX defines\%using\chardef, then we have to write\csstring\%instead\%in\directlua. – wipet Jan 25 '23 at 07:07