Clean the surface of both the foundation and the sidewalk using a garden hose and spray attachment. Rinse away as much dirt and debris as possible. Allow the surfaces to dry.
Measure the space's width. Spaces smaller than a half-inch require only caulk. Spaces larger than a half-inch require the use of foam backer rod, as well as caulk.
Measure the space's length. Transfer this measurement to a piece of foam backer rod. Cut the rod to the appropriate length using a scissors. Stuff the foam backer rod down into the space. If the space is longer than a full piece of foam backer rod, push a second foam backer rod into the hole with one of its ends tight against the first foam backer rod. Skip this step if the space is less than a half-inch wide.
Place a tube of acrylic siliconized latex caulk in a caulk gun, and cut off the tip with a scissors. Apply a bead of caulk into the gap, directly over the top of the foam backer rod if you installed it. Fill the gap completely.
Run a damp finger over the caulk bead to smooth it.