Recently the LHCb collaboration has measured both longitudinal and transverse momentum distribution of hadrons produced inside $Z$-tagged jets in proton-proton collisions at the Large Hadron Collider. These distributions are commonly referred to as jet fragmentation functions and are characterized by the longitudinal momentum fraction $z_h$ of the jet carried by the hadron and the transverse momentum $j_perp$ with respect to the jet direction. We derive a QCD formalism within Soft-Collinear Effective Theory to describe these distributions and find that the $z_h$-dependence provides information on standard collinear fragmentation functions, while $j_perp$-dependence probes transverse momentum dependent (TMD) fragmentation functions. We perform theoretical calculations and compare our results with the LHCb data. We find good agreement for the intermediate $z_h$ region. For $j_perp$-dependence, we suggest binning in both $z_h$ and $j_perp$, which would lead to a more direct probing of TMD fragmentation functions.