  The class of long gamma-ray bursts (LGRBs) is associated with the collapse of
the most massive stars, making them a tool to investigate star formation in the
early Universe. Furthermore, thanks to their exceptional brightness, LGRB
afterglows can be used as extra-galactic background sources capable of
unveiling the properties of the cold/warm gas of their hosting galaxies, up to
the highest redshifts. Therefore LGRBs allow, uniquely, the combination of the
information on different phases of the gas, through the absorption lines
present in the afterglow spectra and the emission (continuum and lines)
properties obtained from host galaxy photometry and spectroscopy, once the
afterglow disappeared. To date, the main problem to carry out this kind of
studies at very high redshift is the poor number of GRBs detected at $z>5$. The
THESEUS mission will hugely increase such number, as it is expected to detect
$>100$ GRBs at $z>5$. Therefore, THESEUS will bring a unique and fundamental
contribution to the understanding of the chemical enrichment of the universe
and of the evolution of galaxies and star formation up to the highest redshift.
