A £24.5 million fund has been allocated for the security of places of worships and schools in the UK.