  Extreme-mass-ratio inspirals (EMRIs) could be detected by space-borne
gravitational-wave (GW) detectors, such as the Laser Interferometer Space
Antenna (LISA), TianQin and Taiji. Localizing EMRIs by GW detectors can help us
select candidate host galaxies, which can be used to infer the cosmic expansion
history. In this paper, we demonstrate that the localization information can
also be used to infer the formation channel of EMRIs, and hence allow us to
extract more precisely the redshift probability distributions. By conducting
mock observations of the EMRIs which can be detected by TianQin and LISA, as
well as the galaxies which can be provided by the future Chinese Space Station
Telescope, we find that TianQin can constrain the Hubble-Lema\^itre constant
$H_0$ to a precision of $\sim3\%-8\%$ and the dark energy equation of state
parameter $w_0$ to $\sim10\%-40\%$. The TianQin+LISA network, by increasing the
localization accuracy, can improve the precisions of $H_0$ and $w_0$ to
$\sim0.4\%-7\%$ and $\sim4\%-20\%$, respectively. Then, considering an
illustrative case in which all EMRIs originate in AGNs, and combining the mock
EMRI observation with a mock AGN catalog, we show that TianQin can recognize
the EMRI-AGN correlation with $\sim 1300$ detections. The TianQin+LISA network
can reduce this required number to $\sim 30$. Additionally, we propose a
statistical method to directly estimate the fraction of EMRIs produced in AGNs,
$f_{\rm agn}$, and show that observationally deriving this value could
significantly improve the constraints on the cosmological parameters. These
results demonstrate the potentials of using EMRIs as well as galaxy and AGN
surveys to improve the constraints on cosmological parameters and the formation
channel of EMRIs.
