High-accuracy spectroscopy of hydrogen molecular ions has important applications for the metrology of fundamental constants and tests of fundamental theories. Up to now, the experimental resolution has not surpassed the part-per-billion range. We discuss two methods by which it could be improved by a huge factor. Firstly, the feasibility of Doppler-free quasidegenerate two-photon spectroscopy of trapped and sympathetically cooled ensembles of HD+ ions is discussed, and it is shown that rovibrational transitions may be detected with a good signal-to-noise ratio. Secondly, the performance of a molecular quantum-logic ion clock based on a single Be+-H2 + ion pair is analyzed in detail. Such a clock could allow testing the constancy of the proton-to-electron mass ratio at the 10-17/yr level.