Can MacOs Apple ID and iMessage app Apple ID be different?

If my Mac is not signed in to iCloud and I sign in to iMessage (left), does that only sign in to iMessage, or does it also set the Apple ID for MacOs and sign the whole machine into iCloud (right)?

Similarly can the two Apple IDs shown below be different?

enter image description here

If the answer is version-specific, my MacOs version is 10.15.7.