Uefy 2.0 (Pro Edition) make Blender's rigify rigs compatible with UE5, also has a FREE version

The usual way is to use traces from the feet location downward to determine distance from ground. Then adjust the feet with FABRIK nodes in the Animgraph.