Radiation damage in biological systems by ionizing radiation is predominantly caused by secondary processes such as charge and energy transfer leading to the breaking of bonds in DNA. Here, we study the fragmentation of cytosine (Cyt) and thymine (Thy) molecules, clusters and microhydrated derivatives induced by direct and indirect ionization initiated by extreme-ultraviolet (XUV) irradiation. Photofragmentation mass spectra and photoelectron spectra of free Cyt and Thy molecules are compared with mass and electron spectra of Cyt/Thy clusters and microhydrated Cyt/Thy molecules formed by aggregation in superfluid helium (He) nanodroplets. Penning ionization after resonant excitation of the He droplets is generally found to cause less fragmentation compared to direct photoionization and charge-transfer ionization after photoionization of the He droplets. When Cyt/Thy molecules and oligomers are complexed with water molecules, their fragmentation is efficiently suppressed. However, a similar suppression of fragmentation is observed when homogeneous Cyt/Thy clusters are formed in He nanodroplets, indicating a general trend. Penning ionization electron spectra (PIES) of Cyt/Thy are broad and nearly featureless but PIES of their microhydrated derivatives point at a sequential ionization process ending in unfragmented microsolvated Cyt/Thy cations.