Guiding functions and periodic solutions to functional differential equations