Catalyzes the hydrolysis of the N-glycosidic bond in the first two intermediates of riboflavin biosynthesis, which are highly reactive metabolites, yielding relatively innocuous products. Thus, can divert a surplus of harmful intermediates into relatively harmless products and pre-empt the damage these intermediates would otherwise do. May act on other substrates in vivo. Has no activity against GTP, nucleoside monophosphates or ADP-ribose. 2,5-diamino-6-hydroxy-4-(5-phosphoribosylamino)-pyrimidine + H2O = 2,5,6-triamino-4-hydroxypyrimidine + D-ribose 5-phosphate 5-amino-6-(5-phospho-D-ribosylamino)uracil + H2O = 5,6-diaminouracil + D-ribose 5-phosphate Belongs to the YbiA family.