Spell of sweltering weather expected to last several days as temperatures hit 40C and UN urges countries to develop better warning systems