Functionals of a stochastic process Y (t) model many physical time-extensive observables, for instance particle positions, local and occupation times or accumulated mechanical work. When Y (t) is a normal diffusive process, their statistics are obtained as the solution of the celebrated Feynman-Kac equation. This equation provides the crucial link between the expected values of diffusion processes and the solutions of deterministic second-order partial differential equations. When Y (t) is non-Brownian, e.g., an anomalous diffusive process, generalizations of the Feynman-Kac equation that incorporate power-law or more general waiting time distributions of the underlying random walk have recently been derived. A general representation of such waiting times is provided in terms of a Lévy process whose Laplace exponent is directly related to the memory kernel appearing in the generalized Feynman-Kac equation. The corresponding anomalous processes have been shown to capture nonlinear mean square displacements exhibiting crossovers between different scaling regimes, which have been observed in numerous experiments on biological systems like migrating cells or diffusing macromolecules in intracellular environments. However, the case where both spaceand time-dependent forces drive the dynamics of the generalized anomalous process has not been solved yet. Here, we present the missing derivation of the Feynman-Kac equation in such general case by using the subordination technique. Furthermore, we discuss its extension to functionals explicitly depending on time, which are of particular relevance for the stochastic thermodynamics of anomalous diffusive systems. Exact results on the work fluctuations of a simple non-equilibrium model are obtained. An additional aim of this paper is to provide a pedagogical introduction to Lévy processes, semimartingales and their associated stochastic calculus, which underlie the mathematical formulation of anomalous diffusion as a subordinated process.