This mod requires Fabric, not Forge. (FpsReducer (Forge) is similar.)
Dynamic FPS automatically reduces the speed at which minecraft renders when it's not focused (to 1 FPS, configurable) or hidden (no renders at all, configurable). It also fixes a bug in Vanilla Minecraft that makes it take much more performance in the background than it should, as well as making the game not render while reloading resources (which makes it take forever on my machine!).
By default, it also reduces the game volume to 25% when unfocused and 0% when hidden (both configurable).
There is an in-game config screen. To access it, install Mod Menu and Cloth Config—find Dynamic FPS in the mod list, then click the gear button.