What is the difference between equation and formula? Sometimes equation and formula are used interchangeably, but I was wondering if there is a difference.

For example, suppose we can calculate a car's fuel efficiency as:

mpg = distance traveled in miles / the fuel used in a gallon


Is that an equation or formula?
An equation is any expression with an equals sign, so your example is by definition an equation.  Equations appear frequently in mathematics because mathematicians love to use equal signs.

A formula is a set of instructions for creating a desired result.  Non-mathematical examples include such things as chemical formulas (two H and one O make H2O), or the formula for Coca-Cola (which is just a list of ingredients). You can argue that these examples are not equations, in the sense that hydrogen and oxygen are not "equal" to water, yet you can use them to make water.

Mathematicians have long since realized that when it comes to numbers, certain formulas can be expressed most succinctly as equations.  For example, the Pythagorean Theorem $a^2+b^2=c^2$ can be thought of as a formula for finding the length of the side of a right triangle, but it turns out that such a length is always equal to a combination of the other two lengths, so we can express the formula as an equation.  The key idea is that the equation captures not just the ingredients of the formula, but also the relationship between the different ingredients.

In your case, "mpg = distance/gallons" is best understood as "a formula in the form of an equation", which means that in this instance the two words are interchangeable.
One way to answer this question has been developed in the first and second courses of U.S. high school algebra.
In the fist course, the following definitions are formally stated in the glossary.

equation: A statement formed by placing an equals sign between two numerical or variable expressions.

For example, $11-7=4$, $5x-1=9$, and $y+2=2+y$ are all equations because they all satisfy the given definition.
The following definition for a formula is also found formally stated in the glossary:

formula: An equation that states a rule about a relationship.

Here are two useful formulas: $A=lw$, the formula for the area of a rectangle; $P=2l+2w$, the formula for the perimeter of a rectangle.
While at the beginning of the the second course, the following sentence summarizes that the relationship is between two or more variables:

A formula is an equation that states a relationship between two or more variables.