If someone is in difficulty in water, don't enter the water unless it's safe to do so.
Once the person is on land, you need to check if they're breathing.
Call 112 / 911 / 999 (or another number for a country you're in)
If they're not breathing, open the airway and give them CPR.
If the person is unconscious but still breathing, put them into the recovery position with their head lower than their body and call an ambulance immediately.
Continue watching the patient to ensure they don't stop breathing and continue to breathe normally.