With the growing number of gravitational-wave detections and the advent of large galaxy redshift surveys, a new era in cosmology is unfolding. This study explores the synergies between gravitational waves and galaxy surveys to jointly constrain cosmological and gravitational-wave population parameters. We introduce CHIMERA (https://github.com/CosmoStatGW/CHIMERA), a novel code for gravitational-wave cosmology combining information from the population properties of compact binary mergers and galaxy catalogs. We study constraints for scenarios representative of LIGO-Virgo-KAGRA O4 and O5 observing runs, assuming to have a complete catalog of potential host galaxies with either spectroscopic or photometric redshift measurements. We find that a percent-level measurement of H0 could be achieved with the best 100 binary black holes in O5 using a spectroscopic galaxy catalog. In this case, the intrinsic correlation that exists between H0 and the binary black hole population mass scales is broken. Instead, by using a photometric catalog the accuracy is degraded up to a factor of ∼9, leaving a significant correlation between H0 and the mass scales that must be carefully modeled to avoid bias. Interestingly, we find that using spectroscopic redshift measurements in the O4 configuration yields a better constraint on H0 compared to the O5 configuration with photometric measurements. In view of the wealth of gravitational-wave data that will be available in the future, we argue the importance of obtaining spectroscopic galaxy catalogs to maximize the scientific return of gravitational-wave cosmology.