Gauss's Law applies to any closed surface. It's a useful tool since it allows you to calculate the amount of confined charge by mapping the field on a surface outside of the charge distribution. It makes calculating the electric field easier for geometries with enough symmetry.