  We study Brezis-Nirenberg type problems, governed by the double phase
operator $- \mathrm{div}\left(|\nabla u|^{p-2}\, \nabla u + a(x)\, |\nabla
u|^{q-2}\, \nabla u\right)$, that involve a critical nonlinearity of the form
$|u|^{p^\ast - 2}\, u + b(x)\, |u|^{q^\ast - 2}\, u$. Both for the local case
and for related nonlocal Kirchhoff type problems, we prove new compactness and
existence results using variational methods in suitable Musielak-Orlicz Sobolev
spaces. For these functional spaces, we prove some continuous and compact
embeddings that are of independent interest. The study of the local problem is
complemented by some nonexistence results of Poho\v{z}aev type.
