How can I achieve a depth of field effect that only blurs distant objects?

I’m referring to the older Depth of Field (DoF) effect that would only blur distant backgrounds. Since the release of Unreal Engine 5, the DoF system has changed — now it applies blur not just to the background, but also to objects that are close to the camera. As it stands, you have to define a focal point, and anything not within that focal range gets blurred. This becomes problematic and even unplayable when nearby objects end up blurred as well.