Dirichlet Boundary Conditions on Subdomains in FEniCSx

I guess you are referring to A.ident_zeros() in legacy dolfin?
As this simply calls petsc, you can still do this in DOLFINx, as illustrated in the following code:
(The following code is a refined snippet of @CastriMik code at thomas-fermi-demo/demo_tf_mwe.py at mpi-issue · mikics/thomas-fermi-demo · GitHub which avoid global communciation)

problem._A.zeroEntries()

fem.petsc.assemble_matrix(problem._A, problem._a, bcs=problem.bcs)
problem._A.assemble()

# Get diagonal of assembled A matrix
diagonal = problem._A.getDiagonal()
diagonal_values = diagonal.array

# Get zero rows of assembled A matrix.
zero_rows = problem._A.findZeroRows()
zero_rows_values_global = zero_rows.array
local_start = V.dofmap.index_map.local_range[0]*V.dofmap.index_map_bs

# Maps global numbering to local numbering
zero_rows_values_local = zero_rows_values_global - \
    local_start
diagonal.array[zero_rows_values_local] = np.ones(
    len(zero_rows_values_local), dtype=PETSc.ScalarType)
problem._A.setDiagonal(diagonal, PETSc.InsertMode.INSERT_VALUES)
problem._A.assemble()