$q$-deformed Whittaker functions and Demazure modules