Magnetotransport and superconducting properties are investigated for uniformly La-doped SrTiO3 films and GdTiO3/SrTiO3 heterostructures, respectively. GdTiO3/SrTiO3 interfaces exhibit a high-density two-dimensional electron gas on the SrTiO3-side of the interface, while for the SrTiO3 films carriers are provided by the dopant atoms. Both types of samples exhibit ferromagnetism at low temperatures, as evidenced by a hysteresis in the magnetoresistance. For the uniformly doped SrTiO3 films, the Curie temperature is found to increase with doping and to coexist with superconductivity for carrier concentrations on the high-density side of the superconducting dome. The Curie temperature of the GdTiO3/SrTiO3 heterostructures scales with the thickness of the SrTiO3 quantum well. The results are used to construct a stability diagram for the ferromagnetic and superconducting phases of SrTiO3.