You can control access to a document by implementing a password for it. Passwords are case-sensitive and can be a maximum of 15 characters long. Create a strong password, ideally one that you can easily remember. But in case you might forget, you should also keep a copy of it in a safe place.
If you lose or forget your document password, Word won't be able to recover it for you. It may be possible for your IT admins to help with password recovery, but only if they had implemented the DocRecrypt tool before you created the document password.
Word Online cannot password encrypt a document. Also, it cannot edit a password-encrypted document. To password protect a Word document, use Open in Word to open it in the desktop version of Word. Thereafter, you must use the Word desktop program to open and edit the document.
If you're concerned about people in your organization losing access to password-protected Microsoft 365 files, consider implementing the DocRecrypt tool. Note that DocRecrypt can only help to recover files that were encrypted after it was implemented. For more information see Remove or reset file passwords using DocRecrypt.