Instant messaging and emails are both susceptible to malware. However, emails are more prone to malware and viruses. Although emails are often encrypted while in transit, they are typically stored unencrypted on the email server. Therefore email isn't secure by default.
Instant messaging apps are built with security and privacy in mind, therefore end-to-end encryption makes instant messenger safer than email to some extent.