Sort of… it’s more accurate to say that the AC unit has 2 sides, which are entirely separate from each other, except for the refrigerant and its associated tubing.
The gaseous refrigerant is compressed to liquefy it, which heats it up. Outside air is run over the liquid phase refrigerant coils to remove that heat. The now cooled (to outside ambient more or less) liquid refrigerant moves into the house, where it goes through an expansion valve, which lets it become gaseous, dropping the temperature well beyond the inside ambient. The inside air is passed over the gaseous refrigerant in those coils, warming it up. It then passes outside to the compressor, which compresses it, and so on and so forth. It literally does move heat from the low pressure (gas side) to the high pressure (liquid) side.
Dehumidifiers just do all this stuff in line- they basically run the gas side first, and let water condense on the coils, and then run that air past the liquid coils which heats it back up. I think, but I’m not 100% sure, that the amount of excess heat that the dehumidifier releases into your room is directly related to the amount of water that it condenses out of the air, as it basically supplies the energy to make that vapor/liquid phase change for the water, and then dumps that as waste heat into the air stream.