Hi there nariah289,
If you are currently signed into that iCloud account on an Apple device (like an iPhone), you can try changing the password in Settings. Once that is changed, you should be able to sign out without any issues. The steps below can walk you through how to do that:
Change your Apple ID password on your iPhone, iPad, iPod touch, or Apple Watch
1. Tap Settings > your name > Password & Security.
2. Tap Change Password.

3. Enter your current password or device passcode, then enter a new password and confirm the new password. Forgot your password?
4. Tap Change or Change Password.
Those steps are from this article: Change your Apple ID password - Apple Support
Also, before signing out, if you plan to use this iCloud or Apple ID account again in the future, you'll want to make sure that your trusted phone number is fully up-to-date, so that you can always receive verification codes. You may even consider adding multiple trusted phone numbers as well. The steps below show how:
Add or remove a trusted phone number
When you enrolled in two-factor authentication, you had to verify one trusted phone number. You should also consider adding other phone numbers you can access, such as a home phone, or a number used by a family member or close friend.
1. Go to Settings
> [your name] > Password & Security.
2. Tap Edit (above the list of trusted phone numbers), then do one of the following:
* Add a number: Tap Add a Trusted Phone Number.
* Remove a number: Tap
next to the phone number.
That information, and more, can be found here: Manage two-factor authentication for your Apple ID from iPhone - Apple Support
We hope that information helps.
Take care.