We effect a complete study of the thermodynamic formalism, the entropy spectrum of Birkhoff averages, and the ergodic optimization problem for a family of parabolic horseshoes. We consider a large class of potentials that are not necessarily regular, and we describe both the uniqueness of equilibrium measures and the occurrence of phase transitions for nonregular potentials in this class. Our approach consists in reducing the problems to the study of renewal shifts. We also describe applications of this approach to hyperbolic horseshoes as well as to noninvertible maps, both parabolic (with the Manneville-Pomeau map) and uniformly expanding. This allows us to recover in a unified manner several results scattered in the literature. For the family of hyperbolic horseshoes, we also describe the dimension spectrum of equilibrium measures of a class of potentials that are not necessarily regular. In particular, the dimension spectra need not be strictly convex.