Before you do anything, make sure you have a good backup of this encrypted DMG file just in case something goes wrong.
While you should always have frequent & full backups of your system, for this you can just make a local copy of the DMG file to the same APFS volume (with the APFS file system, a local copy to the same APFS volume will just create another link to the same physical data so it should not require any extra storage space at least until you make changes to the data within the DMG file).
You will need to use the Terminal app to change the DMG's password.
The command template is:
hdiutil chpass <path-to-encrypted-DMG>
For those unfamiliar with the command line, it is easiest if you first type "hdiutil chpass " into the Terminal making sure to leave at least one space at the end of the line:
hdiutil chpass
Now find your encrypted DMG file with the Finder......drag & drop the DMG file from the Finder onto the open Terminal window so the full path to the DMG is auto filled. It will end up looking something like:
hdiutil chpass /Users/hwtech/Documents/Encrypted.dmg
Press the "Return" key to submit the command to be executed. You will be prompted to enter your current password for the encrypted DMG, followed by a prompt to enter the new password & another prompt to confirm the new password.
I have tested this command with both the DMG file locked & unlocked/mounted....it doesn't seem to make a difference, personally I would recommend unmounting/ejecting the mounted DMG first just to be 100% safe.