The census of planets around M dwarfs in the solar neighbourhood meets two challenges: detecting the best targets for the future characterisation of planets with ELTs, and studying the statistics of planet occurrence that are crucial to formation scenarios. The radial velocity (RV) method remains the most appropriate for such a census as it is sensitive to the widest ranges of masses and periods. HARPS, mounted on the 3.6 m telescope at La Silla Observatory (ESO, Chile), has been obtaining velocity measurements since 2003, and can therefore be used to analyse a very large and homogeneous dataset. We performed a homogeneous analysis of the RV time series of 200 M dwarfs observed with HARPS from 2003 to 2019 (gathering more than 15000 spectra), with the aim of understanding detectable signals such as stellar and planetary companions and activity signals. The RVs were computed with a template matching method before carrying out the time series analysis. First, we focused on the systematic analysis of the presence of a dominant long-term pattern in the RV time series (linear or quadratic trend and sine function). Then, we analysed higher-frequency perdiodic signals using periodograms of the residual time series and Keplerian function fitting. We found long-term variability in 57 RV time series (28.5%). This led to the revision of the parameters of the massive planet (GJ 9482 b), as well as the detection of four substellar and stellar companions (around GJ 3307, GJ 4001, GJ 4254, and GJ 9588), for which we characterised inclinations and masses by combining RV and astrometry. The periodic analysis allowed us to recover 97% of the planetary systems already published in this sample, but also to propose three new planetary candidates orbiting GJ 300 (7.3M_{Earth}_), GJ 654(5M_{Earth}_), and GJ 739 (39M_{Earth}_), which require additional measurements before they can be confirmed.