Heavy flavor probes are sensitive to the properties of the quark gluon plasma (QGP) produced in relativistic heavy-ion collisions. A huge amount of effort has been devoted to studying different aspects of the heavy-ion collisions using heavy flavor particles. In this work, we study the dynamics of heavy quark transport in the QGP medium using the rapidity dependence of heavy flavor observables. We calculate the nuclear modification of $text{B}$ and $text{D}$ meson spectra as well as spectra of leptons from heavy flavor decays in the rapidity range $[-4.0,4.0]$. We use an implementation of the improved Langevin equation with gluon radiation on top of a (3+1)-dimensional relativistic viscous hydrodynamical background for several collision setups. We find that the rapidity dependence of the heavy quark modification is determined by the interplay between the smaller size of the medium, which affects the path length of the heavy quarks, and the softer heavy quark initial production spectrum. We compare our results with available experimental data and present predictions for open heavy flavor meson $R_text{AA}$ at finite rapidity.