In this paper, we present a protocol to engineer upper-bounded and sliced Jaynes-Cummings and anti-Jaynes-Cummings Hamiltonians in cavity quantum electrodynamics. In the upper-bounded Hamiltonians, the atom-field interaction is confined to a subspace of Fock states ranging from $leftvert 0rightrangle $ up to $leftvert 4rightrangle $, while in the sliced interaction the Fock subspace ranges from $leftvert Mrightrangle $ up to $leftvert M+4rightrangle $. We also show how to build upper-bounded and sliced Liouvillians irrespective of engineering Hamiltonians. The upper-bounded and sliced Hamiltonians and Liouvillians can be used, among other applications, to generate steady Fock states of a cavity mode and for the implementation of a quantum-scissors device for optical state truncation.