It's possible I picked up
A Chance Child, by Jill Paton Walsh (1978), as a child, but if so I'm sure I would have put it down after just a few pages, which are both confusing for the reader and miserable for the main character. But grown-up me read on, and though there was plenty of misery to come, it lessened somewhat, and the confusion gave signs of clearing....
It begins in a hellish, massive dump, in which a lost, starved, unwanted child called Creep wanders not knowing what he is doing. It is unclear if it is past or present, and unclear who Creep is. The wasteland abuts a canal, and Creep finds refuge in an old canal boat, which starts him on a journey.
Then the point of view shifts to Christopher, a boy who is desperately hunting for Creep, his half-brother. Christopher is definitely in the present of the book (which of course is in the distant past for modern kids), and gives the reader more information--turns out, this is Creep's first time outside ever; part of the house has collapsed, opening the cupboard where he has been confined all his life. Christopher looked after Creep as much as he could, risking his mother's anger, and cares about what danger he might be in, enough so that he's on the verge of breaking all his mother's brainwashing and going to the authorities.
Then Creep, in the narrowboat, flows down the canal, on a journey into the child labor horrors of the Industrial Revolution. As a grown-up I recognized that this was now the past, but it wasn't spelled out to the child reader and I bet I wouldn't have known at this point that Creep was time travelling (I was, for instance, a great re-reader of Joan Aiken and would have probably taken it all in my stride without question). Creep acquires two great comrades in his journey, a girl and a boy who he helps escape from the dangerous misery of their labors (the boy has been pickaxed in his bottom, and the girl fell face down into a fire). The girl can write a little, and carves "Creep" into a bridge stone to show him.
This carving Christopher, after more than a day and night of searching, sees, and realizes that it was done long long ago. He has a realization that Creep has gone where he can't be found (I hope child reader me would have picked up on the time travel at this point, but you never know).
Creep and his two friends have a relatively nice bit of work at a pottery (they aren't in mortal peril, though it is grueling work) and are able to make the canal boat homelike, but this interlude is shattered (literally, by broken pottery). Tom, the boy, goes off on his on to be a miner, and Creep and the girl find (horrible, dangerous) work in a mill.
All this time, only children have ever been able to see Creep, and he's never felt any need to eat or drink, and he's never laughed. When he does finally do so, he's solid and real back in the past...and on his way to a (mercifully) happy ending. And Christopher back in the present, still desperate to find his poor brother, starts doing historical research, and finds that Creep himself wrote the story of his life (confirming, in case child me still needed it, that time travel, quite possibly in the form of a canal boat with something of a mind of its own, had taken Creep away).
It was a bit too much "let's go on a journey through child labor horrors (burns, beatings, torture) while simultaneously being confronted with a tortured child in the present for my personal taste, which much preferred "canal boat home making," "found family," and "library research." And there was lots and lots of description, a lot of it about unpleasant things, that either brought everything vividly (too much so?) to life, or slowed the story down, depending.
Still, once I was into it and not much confused, I found it fast reading, and became invested in what was happening. And it does have a happy ending in which found family in the past becomes real family, and Creep and Christopher's mother is being investigated by the authorities who have found Creep's birth certificate....