Start by looking at your gas bill and your electric bill to find the rates:
Cost per kWHr of electricity and cost per therm of gas.
One therm is 100,000 BTUs which is energy equivalent to 29.3 kWHr, but you aren't done yet because of different efficiencies.
Electric water heater losses are essentially only the heat loss from the tank. You will not be far off if you use 96% efficiency. Gas water heater efficiencies vary more depending on whether you have a condensing unit or a standard heater. I haven't looked them up but they are probably in the range of 70 to 95% depending on the unit.
For your 96% efficient electric heater at $0.10 per kWHr it will cost you $3.05 to get 100,000 BTUs of usable hot water. To get the cost in your area, adjust by using your electric rate.
If gas is $2.50 per therm and your gas water heater is 85% efficient, then it will cost you $2.50/0.85 = $2.94 to get 100,000 BTUs of usable hot water. Again, adjust by your rate and efficiency.
An alternative for long distance water heating, if you have an adequate and efficient gas water heater in your house, is to put a small local heater at the distant location and feed it from the gas water heater. Something like the Ariston GL2.5 operates off a 115 Volt circuit and will supply all you need for the lavatory or sink flows, and the gas water heater will make up the hot water demand for showers and other larger uses. It doesn't eliminate all the pipe heat losses but it avoids people running water down the drain to get hot water out of the faucet.