You can go to a public hospital if you are seriously unwell, and it is an emergency. For all other times you need to be referred by a health professional, usually your doctor.
If it’s an emergency phone 111 and ask for an ambulance. If you’re near the hospital and the situation is serious but not life threatening you/the person may be taken by car to the hospital. (As long as the driver knows where the hospital’s emergency department is.)
Public hospitals are the main providers of emergency, specialist medical, surgical, and other specialist services in New Zealand and are not an alternative to your local doctor. Unless a situation is an emergency be guided by your doctor or after-hours clinic. If you are not sure whether your situation is an emergency ring Healthline freephone 0800 611 116 and they will advise you.
A list of Public Hospitals can be found here. https://www.health.govt.nz/your-health/certified-providers/public-hospital