The history of science is replete with unexpected discoveries with profoundly important effects. The World Wide Web was not developed to address a public need but to help physicists communicate at a high-energy physics laboratory engaged in esoteric studies of the fundamental structure of matter. Theoretical studies of the nature of light emitted by hot objects ended up leading to the development of quantum mechanics, which describes the weird behavior of electrons in atoms. In the process, it led to the development of transistors and all the modern electronics on which modern computers and our information economy is based.
IOW, what works best is letting scientists investigate the area(s) of interest to them. Enough of what they find will be useful to us all, somehow.