Hello lhtnup,
Yes, you can make space in iCloud using this: Manage your iCloud storage - Apple Support
It's true, that for Messages, the folders are only accessible on an iOS or Mac device. Yes, you also need to remove them from that folder to reclaim the space.
You also need to understand, most iPhone and iPad devices are 128GB/256GB or larger, and 5GB of free iCloud storage doesn't last long. It's enough for your data, if you don't backup to iCloud.
Try this, go to Settings > [Your name] > iCloud > Manage Account Storage. You can see what is taking up space, and even empty some items, like in iCloud Drive, you can delete Documents & Data and even delete Downloads in the Documents & Data in the next screen.
Or, you can purchase more iCloud storage, which is the likely step needed in order to backup everything and mot run out of storage since our devices get larger and larger every year. Upgrade to iCloud+ - Apple Support
App data alone depending on how many apps you have, and the type of data, such as game save data, or encrypted Health data, can take up the spade alone: What does iCloud back up? - Apple Support
"When you set up iCloud, you automatically get 5GB of storage. You can use that storage space for your iCloud backups, to keep your photos and videos stored in iCloud Photos, and your documents up to date in iCloud Drive. Depending on the size of your backup and amount of content you keep in iCloud, you might run out of free space. You can buy more iCloud storage or delete content."
Thanks.