How can you change font size with OSM tiles as background layer in QGIS

Raster tiles are “static” bitmaps that you can’t change (reasonably) on the fly. You could probably try the shiny new OSMF provided vector tiles, if you want to use your own style.

See Vector tiles on OSMF hardware