YJ-12 for 056 might be a bit of an overkill. I doubt its sensors can even utilise the missile efficiently
The 056 mounts the YJ-83, which goes up to 200km, and that's definitely over the horizon. So the ship has some undocumented ability that allows for long range OTH targeting.
051B refit 167 Shenzhen doesn't have the sensors for it either. Note that the ship does not have the Type 366 'Bandstand' antiship radar, unlike all the 052B/C/D and 054A, even if the Shenzhen has 16 YJ-12. So like the 056, the 051B refit has to have some undocumented ability that allows for over the horizon antiship missile targeting. Usually with ships, that is attained two ways. The first is from an aircraft spotter from which the ship is communicating via datalink. This can be amended and updated to using UAVs and even satellites. The other is through directional ESM, where the ship triangulates its target via the target's long range radio emissions. Most ships do not use their main radars to target other ships, as they are all line of sight and limited by the radar horizon. If a target is within line of sight, which means like 30km or less, the gunnery fire control radar can also act to target the enemy ship directly.
Its the Russians that use some form of over the horizon antiship targeting radar, of which there are a few, but the most well known is the unit code named 'Bandstand', which consists of an active radar unit, a passive ESM unit and a cooperative datalink. This unit is bought, then copied by the Chinese and improved into a version of their own, making them a ubiquitous presence in PLAN. While the 052C/D and the 054A has the Chinese version, while the Sovs, the 051C and the 052B has the original Russian version, the 052, 053H3, 054, 051B, the 056 and 056A lack these, even if they are using the YJ-83. So all these other ships have to be using datalinks and/or directional finding ESM. Assuming that directional finding ESM still has some range limit, risks being inaccurate and situational, the most reliable means of long range targeting is via air, whether through patrol aircraft, helicopter, or UAV, and potentially even by satellite, communicating their findings to the ship via datalink. Even the 056 has some datalinks, including SATCOMs.