What happens is that all your pictures from your iPhone will be copied to iCloud. All your pictures from your Mac will also be coped to iCloud. iCloud will only copy pictures it doesn't already have. Then it will copy all its pictures to both the iPhone and the Mac, so all three places will have all the same pictures. As you can imagine, this may take a while (days, probably) to finally have it all synchronized.
No pictures will be lost. iCloud Photos synchronizes the three locations (and others if you have them connected), so they are all the same. Keep in mind that this means that, if you delete a picture on your iPhone, it will be deleted everywhere. If you delete a picture on your Mac, it will be deleted everywhere. So be careful! But there's no need to worry-- deleted means the picture goes into the Recently Deleted folder where it is still savable for 30 days.
Set up and use iCloud Photos - Apple Support