Mojave 10.14.6 on both computers on local area network
There are two MBPs – 'Dog' and 'Cat' – on my LAN. I use 'Dog' as a server which I control from 'Cat' with Screen Sharing. Most of the times I try to connect, I get a "Connecting to Dog…" message and have to wait about 30 seconds until Dog's desktop appears in the Screen Sharing window.
Sitting next to Dog while attempting to connect, I can see Dog's screen immediately wake up. And I can ssh from Cat to Dog almost instantly. I can't figure out what is causing the delay.
I do notice that if Dog's screen is still awake, the connection process is very quick, so there's probably a clue.