The court heard that James Allen told a friend that he was dying of cancer on the night of one of the murders.
A friend of James Allen said that he took pity on him, and offered him somewhere to stay the night.
Allen is accused of murdering a pensioner in Middlesbrough last April, as well as a woman in Whitby.
The trial continues.
More top news
New law will protect the dignity of both men and women, the Government says.
Transport Secretary Chris Grayling has survived a vote of no confidence, amid claims his credibility will "never recover" .
Mark Smith has confessed to killing 38-year-old Jillian Grant, whose body was discovered in North Shields on December 25 last year.