two more solutions:
\documentclass{article}
\usepackage{makecell}
\usepackage{tabularray}
\begin{document}
with \verb+makecell+:
\medskip
\begin{tabular}{ |wc{14mm}|wc{14mm}| }
\makecell{foo\\ longer}
& \makecell{bar\\ center}
\end{tabular}
\bigskip
with \verb+tabularray+:
\medskip
\begin{tblr}{ |Q[c,14mm]|Q[c,14mm]| }
{foo\\ longer}
& {bar\\ center}
\end{tblr}
\end{document}

Edit:
Using tabularray
and column specification as are in above example, you not need to manually split text in cells:
\documentclass{article}
\usepackage{tabularray}
\begin{document}
\begin{tblr}{ |Q[c,14mm]|Q[c,14mm]| }
foo longer
& bar center
\end{tblr}
\end{document}
Result is the same as before.
Addendum:
In the case, that table cells can have natural width, as suggested @L.J.R. in his comment below (thank you very much), than you can omit their width prescription:
\documentclass{article}
\usepackage{makecell}
\usepackage{tabularray}
\begin{document}
with \verb+makecell+:
\medskip
\begin{tabular}{ |c|c| }
\makecell{foo\\ longer}
& \makecell{bar\\ center}
\end{tabular}
\bigskip
with \verb+tabularray+:
\medskip
\begin{tblr}{ |c|c| }
{foo\\ longer}
& {bar\\ center}
\end{tblr}
\end{document}

makecell
package and use the eponymous command.