You can use an air conditioner to cool a room via an internal cooling element, which activates when you select "Cool" mode on the remote control or unit interface. The "Cool" cycle dehumidifies somewhat. Air is pulled in the through the front grille and moisture is evaporated automatically out of the back of the unit as a side effect of the cooling element. The cold air that's blown out of the vents is colder and dryer before it was when it entered the unit.
The primary function of the dehumidifying unit is to remove moisture from the air. A dehumidifier condenses the moisture and allows it to accumulate inside of an internal tank or drain pan. After a while, you must drain the liquid from the unit, whereas moisture from an air conditioner unit evaporates and expels into the outside air. A dehumidifier doesn't feature a cool air function, though it might cool the air slightly as a side effect. An air conditioner unit is usually bigger than a dehumidifier.
Using an air conditioner and a dehumidifier can be effective for large rooms or for super humid rooms. The air conditioner unit will require a window for exhaust purposes and a power outlet. A dehumidifying unit requires a power outlet and requires draining every now and then. Depending on the air conditioner model you're using, you might need to drain it every once in a while as well. Using both units would double the dehumidifying power and cool the room.
Some air conditioner models actually come with a built-in dehumidifier, including most portable air conditioner units. This may be apparent in the form of a button called the "Dry" or "Dehumidifier" button. You press this button on the air conditioner unit and the unit switches to a drying mode that lasts for about 30 minutes, in which the fan speed sets automatically and the unit pulls moisture from the air. The condensation either exhausts out of the portable unit's exhaust hose or collects in an internal drain tank. Once the tank becomes full, the air conditioner illuminates an indicator as a signal to empty the tank before the cycle continues.