iCloud storage is configured separately on the iPhone and the Mac (and other devices you may have). You can put things in your iCloud area from each device as long as the total iCloud usage for your account is under your storage quota. Examples of applications that CAN be configured to use (or not use) iCloud storage include Notes, Pages, Keynote, Photos, Contacts, iPhone backups, Keychain, Safari Bookmarks etc. That configuration is handled in settings separately on each device. The same iCloud is accessed for all devices using the same Apple ID.
When iCloud is being used for storing the same items (photos, contacts etc.) for multiple devices, that storage is just used once and is shared for all those devices. So if you are storing 100 GB of photos in iCloud for each of 5 devices, each of the 5 devices sees those same photos but the iCloud storage is just 100 GB (not 5x100 GB).
https://www.apple.com/icloud/