Drink only bottled water. Avoid lettuce and other raw vegetables. As for cebiche and tiradito (thinly sliced, marinated fish), both made with raw seafood, the citric acid in the lime-juice marinade is as efficient at killing bacteria as cooking, but because they are often prepared to order, let yours stew in the lime juice for a bit before eating to ensure that you don't suffer after enjoying those delicacies.
El Centro is safe during the day, but the neighborhood grows dicey at night, when you should stick to the two main plazas and Jirón de la Union (the pedestrian mall that connects them). Residential neighborhoods like Miraflores, San Isidro, and Barranco have far less street crime, but you should be on your guard away from the main streets. Always be alert for pickpockets in crowded markets and on public transportation.
In case of trouble, contact the Tourist Police. The department is divided into the northern zone (01/423-3500), which includes El Centro, and the southern zone (01/243-2190), which includes Barranco, Miraflores, and San Isidro. English-speaking officers will help you negotiate the system. For emergencies, call the police (105) and fire (116) emergency numbers.