I think there are a lot of misconceptions about Mexico, particularly among Americans who typically learn about Mexico through the lens of migration and border security (i.e., most English-language news coverage of Mexico focuses on immigration and cross-border cartel violence).
While Mexico does have a higher overall homicide rate than the US -- 28 per 100,000 people and 7 per 100,000 people, respectively --
American tourists in Mexico are actually significantly less likely to be the victim of a homicide in Mexico than they are in the United States. The
murder rate of U.S. citizens in Mexico was around 0.26 per 100,000 visitors in 2021, compared to 7 per 100,000 in the US. Cartels are typically reluctant to target Americans due to the fact that the US will inevitably pressure Mexican authorities to arrest the perpetrators, and the Mexican authorities are more likely to take action when prompted by external (international) pressure than internal (domestic) pressure. I have not been able to find exact statistics, but from my experience following crime in Mexico (in Spanish-language media), the homicide clearance rate in cases where the victim is a foreigner (especially US/Canadian) is much higher than for Mexican victims or victims of other Latin American nationalities.
Additionally,
40 to 50 percent of all homicides in Mexico are related to organized crime. Most of the victims in these cases are directly linked to the drug trade -- suppliers, buyers, creditors, rival traffickers, police, military, government officials, and journalists covering the drug war -- rather than random civilians caught in the crossfire (although there has been
a recent increase in murders of civilians by cartels, they are still in the minority).