Prime minister Sir Keir Starmer has pledged £3.5 million in support for veterans facing homelessness.