Localized states in the transition to turbulence in plane Poiseuille flow and thermal boundary layers