CKEditor 5 in Drupal comes with a new Code Block plugin. You can embed blocks of code, formatted for the language.
https://ckeditor.com/docs/ckeditor5/latest/features/code-blocks.html
Previously, I was using the CKEditor CodeSnippet module, which uses highlight.js. The module hasn't been updated for CKEditor 5 yet.
Modules