The CUPID-Mo experiment, located at the Laboratoire Souterrain de Modane (France), was a demonstrator experiment for CUPID. It consisted of an array of 20Li2Mo100O4 (LMO) calorimeters, each equipped with a Ge light detector for particle identification. In this work, we present the result of a search for two-neutrino and neutrinoless double-β decays of Mo100 to the first 0+ and 2+ excited states of Ru100 using the full CUPID-Mo exposure (2.71kgyr of LMO). We measure the half-life of 2νββ decay to the 01+ state as T1/22ν→01+=(7.5±0.8(stat.)-0.3+0.4(syst.))×1020yr. The bolometric technique enables measurement of the electron energies as well as the γ rays from nuclear deexcitation and this allows us to set new limits on the two-neutrino decay to the 21+ state of T1/22ν→21+>4.4×1021yr(90% c.i.) and on the neutrinoless modes of T1/20ν→21+>2.1×1023yr(90% c.i.), T1/20ν→01+>1.2×1023yr(90% c.i.). Information on the electrons' spectral shape is obtained, which allows us to make the first comparison of the single and higher state dominance 2νββ decay models for the 01+ excited state of Ru100