When an air conditioner cools the air, it takes in indoor air and blows it across cold copper coils. These coils, filled with coolant, "sweat" the humidity in the air because of the temperature differential. This sweat drips in to a condensate pan and is drained away from the system, thus reducing indoor humidity. An air conditioner's primary function, however, is to reduce indoor air temperature, so they are designed to do that task well, and dehumidification is something of a byproduct of the cooling method.
Dehumidifiers are essentially small, self-contained air conditioners. Dehumidifiers do not vent to the outside, and thus do not dump hot air outside the house, and do not cool the indoor air temperature. They blow indoor air across coils and remove the condensation, and then pass that same air over coils warmed by the dehumidifier, so that warmer, dryer air emerges from the outlet of the dehumidifier.
Every device using electricity produces waste heat. Dehumidifiers have compressors, condensers, and evaporator, and produce a lot of waste heat. In this way, they are effectively warming the indoor air temperature, and causing the air conditioner to have to run longer to reduce the temperature and cycle off. This makes running a dehumidifier with an air conditioner less energy-efficient when dealing with normal humidity.
A dehumidifier can assist an air conditioner when the indoor humidity level is very high. This can be the case if you are attempting to air condition a damp basement. If your indoor thermostat has a humidity setting, running a dehumidifier can help the air conditioner get the indoor humidity down to a comfortable level and cycle off to save electricity.