The Queen has urged people to heed the warning of history and speak out over rising levels of antisemitism and Islamophobia.