Generally it is fine. It’s just if you have something on the laptop or if you have it in your bag then there is more of a chance of the pressure on the screen forcing it to touch the keyboard.
Normally it wouldn’t be an issue, but the keyboard can leave marks on the anti-glare screen coating that Apple uses on the screen of mac laptops. (Since the retina MBP models debuted I believe.)
Since I've had issues in the past I began to use a microfiber cloth in between the screen/keyboard&trackpad. On my old retina MBP I used a
Radtech Screensavrz cloth. That covered up pretty much the keyboard and trackpad area completely. When I switched over to a touchbar MBP I bought a new one and unfortunately because of the smaller area when closed on the newer models, the updated screensavrz cloth only covered the keyboard area. I've found that the area around the trackpad can also leave marks on the screen though.
That's when I switched over to screen protectors. I prefer having a matte screen anyway and a matte screen protector works well for me.
I have a matte screen protector on my 13" M1 MBP, on my 12.9" M1 iPad Pro and I used to have one on my 16" intel MBP as well. I recently took the 16" in for applecare service (hinge issue) and they ended up replacing my display in the process, so I need to buy another one.
I've used screen protectors on my ipads and iphones without any issues before trying them with my Macs.
edit: Not mine, but you can see an example of keyboard marks (and the trackpad outline) on a recent (2018) MBP here.
https://discussions.apple.com/thread/8506475