M dwarfs are key targets for high-resolution spectroscopic analyses due to a high incidence of these stars in the solar neighbourhood and their importance as exoplanetary hosts. Several methodological challenges make such analyses difficult, leading to significant discrepancies in the published results. We compare M dwarf parameters derived by recent high-resolution near-infrared studies with each other and with fundamental stellar parameters. We also assess to what extent deviations from local thermodynamic equilibrium (LTE) for Fe and K influence the outcome of these studies. We carry out line formation calculations based on a modern model atmosphere grid along with a synthetic spectrum synthesis code that treats formation of atomic and molecular lines in cool-star atmospheres including departures from LTE. We use near-infrared spectra collected with the CRIRES instrument at the ESO VLT as reference observational data. We find that the effective temperatures obtained by the different studies mostly agree to better than 100 K. We see a much worse agreement in the surface gravities and metallicities. We demonstrate that non-LTE effects are negligible for Fe I in M-dwarf atmospheres but are important for K I. These effects, leading to K abundance and metallicity corrections on the order of 0.2 dex, may be responsible for some of the discrepancies in the published analyses. Differences in the temperature-pressure structures of the atmospheric models may be another factor contributing to the discrepancies, in particular at low metallicities and high effective temperatures. In high-resolution spectroscopic studies of M dwarfs attention should be given to details of the line formation physics as well as input atomic and molecular data. Collecting high-quality, wide wavelength coverage spectra of benchmark M dwarfs is an essential future step.