I don't know about safety but it is a LONG drive if you mean Mazatlan And even if you mean Mazatlan 31 you can't really drive to Cozumel because Cozumel is an island. You would have to take a ferry to get there.
Mentioned in this answer:
That is a very long trip. Try to avoid driving at night. Use the main highways. You should be ok.