We present the discovery and characterisation of two transiting planets observed by the Transiting Exoplanet Survey Satellite (TESS) orbiting the nearby (d∗ ≈ 22 pc), bright (J ≈ 9 mag) M3.5 dwarf LTT 3780 (TOI-732). We confirm both planets and their association with LTT 3780 via ground-based photometry and determine their masses using precise radial velocities measured with the CARMENES spectrograph. Precise stellar parameters determined from CARMENES high-resolution spectra confirm that LTT 3780 is a mid-M dwarf with an effective temperature of Teff = 3360 ± 51 K, a surface gravity of log g∗ = 4.81 ± 0.04 (cgs), and an iron abundance of [Fe/H] = 0.09 ± 0.16 dex, with an inferred mass of M∗ = 0.379 ± 0.016M· and a radius of R∗ = 0.382 ± 0.012R·. The ultra-short-period planet LTT 3780 b (Pb = 0.77 d) with a radius of 1.35-0.06+0.06 R·, a mass of 2.34-0.23+0.24 M·, and a bulk density of 5.24-0.81+0.94 g cm-3 joins the population of Earth-size planets with rocky, terrestrial composition. The outer planet, LTT 3780 c, with an orbital period of 12.25 d, radius of 2.42-0.10+0.10 R·, mass of 6.29-0.61+0.63 M·, and mean density of 2.45-0.37+0.44 g cm-3 belongs to the population of dense sub-Neptunes. With the two planets located on opposite sides of the radius gap, this planetary system is anexcellent target for testing planetary formation, evolution, and atmospheric models. In particular, LTT 3780 c is an ideal object for atmospheric studies with the James Webb Space Telescope (JWST)