Apple TV (2nd generation) [A1378] (2010) is not supported by the software remote in iPhone (or iPad), since the software remote was moved to Control Center, rather than the separately downloadable app (no longer available) in the years before that. The software remote is supported on Apple TV (3rd generation) [A1427] (2012) or later.
Apple TV 4K (2nd generation) [A2169] (2021) is supported by the software remote in iPhone (or iPad), just like the four other models A1625 or later.
Set up the Apple TV Remote on your iPhone or iPad - Apple Support
Both devices (iPhone and Apple TV box) need to connect to the same home network. For Wi-Fi, that means the same SSID network name, not just the same network hardware [4]. Please don’t split your network using multiple network names.
If more than one Apple TV box is connectable, then you may need to select the intended Apple TV box from the drop-down menu at the top.