Emergency contraception is most effective the sooner it is used. There are two main pill types with different time windows, and a copper coil that can be fitted within a few days of unprotected sex and is the most effective emergency option overall. A pharmacist or clinic can tell you which is most suitable based on timing, your weight, current medicines, and whether you are breastfeeding.
Emergency pills work mainly by delaying ovulation; they do not end an existing pregnancy and are not intended as regular contraception. They are safe for most people but are a backup, not a routine method.
If you vomit within a couple of hours of taking the pill, or your period is more than about a week late afterwards, seek advice and take a pregnancy test. Also ask about ongoing contraception and, if relevant, sexually transmitted infection testing.