Move in this order and the situation stays manageable. First, search thoroughly once, calmly, since a surprising share of lost passports are in the other bag. Second, file a police report where the loss happened, because your embassy and travel insurance will both want it, and get a copy or reference number. Third, contact your country's nearest embassy or consulate, whose website lists the emergency passport process; call before traveling to them, since many require appointments and specific documents. Fourth, if theft is involved, consider notifying your bank if cards went with it.
For the embassy visit you will typically need the police report, passport photos to local specifications, proof of citizenship such as a photocopy of the lost passport, an ID if you have any, completed forms, and a fee. This is where preparation pays: keep digital and physical copies of your passport stored separately from the original, plus spare photos, and the whole ordeal shrinks to days instead of weeks.
Note that reporting the passport lost generally cancels it permanently, so if it reappears afterwards it is no longer valid for travel. Also check whether the country requires updating your visa or registration into the replacement document before you can exit; the embassy will walk you through that part.