In this paper, we present a method to find periodic solutions for certain types of nonsmooth differential equations or nonsmooth delay differential equations. We apply the method to three examples, the first is a second-order differential equation with a nonsmooth term, in this case the method allows us to find periodic orbits in a nonlinear center. The two remaining examples are first-order nonsmooth delay differential equations. In the first one, there is a stable periodic solution and in the second, the presence of a chaotic attractor was detected. In the latter, the method allows us to obtain unstable periodic orbits within the attractor. For large values of the delay, both examples can be seen as singularly perturbed delay differential equations. For them, an analysis is performed with an associated discrete map which is obtained in the limit of large delays.