Is it better to use ice or heat on an infected tooth?

Ice, Ice Baby. Ice is analgesic, anti-inflammatory and reduces swelling. Heat usually doesn't help in these cases. Make sure you check with your dentist.
Ice. Heat should never be used. Ice can help with an anti-inflammatory effect as well as to provide some slight numbness to the area but a true infection needs to be evaluated and treated by an appropriate treating provider.