Catalyzes the condensation of 4-hydroxybenzoate (HB) with 5-phospho-alpha-D-ribose 1-diphosphate (PRPP) to produce beta-ribofuranosylphenol 5'-phosphate (beta-RFH-P) (By similarity). Also catalyzes the condensation of 4-aminobenzoate (pABA) with PRPP to produce beta-ribofuranosylaminobenzene 5'-phosphate (beta-RFA-P) (PubMed:31663056). Only 4-hydroxybenzoate is known to be biosynthesized by methanogenic archaea, but 4-aminobenzoate can be used as substrate by growing methanogens when it is present in the growth medium (By similarity). 4-hydroxybenzoate + 5-phospho-alpha-D-ribose 1-diphosphate + H(+) = 4-(beta-D-ribofuranosyl)phenol 5'-phosphate + CO2 + diphosphate 4-aminobenzoate + 5-phospho-alpha-D-ribose 1-diphosphate + H(+) = 4-(beta-D-ribofuranosyl)aminobenzene 5'-phosphate + CO2 + diphosphate Optimum pH is 7.0. Optimum temperature is 70 degrees Celsius. Cofactor biosynthesis; 5,6,7,8-tetrahydromethanopterin biosynthesis. Homodimer. Belongs to the beta-RFA-P synthase family.