Aims. Our knowledge of the cosmic mass assembly relies on measurements of star formation rates (SFRs) and stellar masses (M star ), of galaxies as a function of redshift. These parameters must be estimated in a consistent way with a good knowledge of systematics before studying their correlation and the variation of the specific SFR. Constraining these fundamental properties of galaxies across the Universe is of utmost importance if we want to understand galaxy formation and evolution. Methods. We seek to derive SFRs and stellar masses in distant galaxies and to quantify the main uncertainties affecting their measurement. We explore the impact of the assumptions made in their derivation with standard calibrations or through a fitting process, as well as the impact of the available data, focusing on the role of infrared emission originating from dust. Results. We build a sample of galaxies with z > 1, all observed from the ultraviolet to the infrared in their rest frame. The data are fitted with the code CIGALE, which is also used to build and analyse a catalogue of mock galaxies. Models with different star formation histories are introduced: an exponentially decreasing or increasing SFR and a more complex one coupling a decreasing SFR with a younger burst of constant star formation. We define different sets of data, with or without a good sampling of the ultraviolet range, near-infrared, and thermal infrared data. Variations of the metallicity are also investigated. The impact of these different cases on the determination of stellar mass and SFR are analysed. Conclusions. Exponentially decreasing models with a redshift formation of the stellar population z f 8 cannot fit the data correctly. All the other models fit the data correctly at the price of unrealistically young ages when the age of the single stellar population is taken to be a free parameter, especially for the exponentially decreasing models. The best fits are obtained with two stellar populations. As long as one measurement of the dust emission continuum is available, SFR are robustly estimated whatever the chosen model is, including standard recipes. The stellar mass measurement is more subject to uncertainty, depending on the chosen model and the presence of near-infrared data, with an impact on the SFR-M star scatter plot. Conversely, when thermal infrared data from dust emission are missing, the uncertainty on SFR measurements largely exceeds that of stellar mass. Among all physical properties investigated here, the stellar ages are found to be the most difficult to constrain and this uncertainty acts as a second parameter in SFR measurements and as the most important parameter for stellar mass measurements.