I think gluing it would be worse, as then nothing can move, and if it was to try, the glue or the wood would fail, and it would be insecure.
With screws, there is enough play for it to not be an issue, so it might move slightly, but it would still be well secured.
If you're really concerned...