October is the last month of the rainy season, also the wettest month, so the closer you can visit to November, the better. However, there's always some chance of rain in the tropics. Remember that just because October is in the wet season, doesn't mean it will rain in Cancun.
Is it better to go to Mexico in October or November?
This will depend on your preferences, but the Mexico City rainy season is from about April to October, so many want to avoid that. It doesn't usually rain too much in Mexico City in October, but if you want sunny days everyday on your trip, visit in the dry season from November to March.