Foam to fill toilet mating surface gap
Cut your shims so they do not stick out past the porcelain use some silicone to keep them from moving and make sure the toilet does not rock or move. Foam will not reinforce the shims. Use toilet shims. 

Then fill the gap with 100% silicone caulk, white or beige to match the floor.