This question likely suffers from the X Y problem. Where the question (about software) and possible answer (centered on hardware) do not approach the solution using the same methods.
The question is essentially asking how to design a 1-wire interface over longer than normal distances. There are 1-wire Arduino libraries and 1-wire Arduino tutorials. But it is likely you will run into problems if your cable is very long.
Guessing at the distance you want to run your 3 wires (power, ground and data), this may be more an electrical engineering than a software problem.
All wires have resistance. Using a voltage drop calculator from here we can calculate, assuming we are trying to send 5V over an 18 AWG copper wire 100 meters long to a 250mA load, an expected voltage drop of slightly over a volt. That may cause unexpected results.
If this might be an issue, consider an alternate power source such as batteries, solar power or a second mains power adapter for the far Arduino. It may even be considered to over drive the power lines several volts and regulate the voltage at the far end Arduino.
Reference to ground type data transmission is more susceptible to error the longer the cable run. Several options to mitigating unexpected behavior can be made. However switching over to a balanced pair is usually the best option.
If you are willing to power the far Arduino independently or add 1 additional data wire (either of these options will make available 2 wires for data) we can run the data portion of the cable for a good distance while mitigating noise problems associated with long communication cable runs.
Consider using an RS485 hardware interface at the near and far Arduino. RS485 interfaces can be source easily for Arduino projects (here and here are two examples) and there are Arduino RS485 software libraries which handle the communications.
The intent of the project was not disclosed in the question. However here is an example RS485 project where connected Arduinos communicate the position of a potentiometer such that the RS485 connected Arduino at the far end can mimic the potentiometer's movements on a motor driven servo.
The keen eye may note that the above project only uses 2 wires between the two Arduinos. This is possible because in the above project the two Arduinos are independently powered (this is not seen in the diagram on the linked to web page). Additionally, RS485 uses a balanced pair of signals (the 2 wires) and does not need to run an additional ground between the two Arduinos as a reference to detect the difference between 1s and 0s.