According to Home Office statistics York is one of the safer student cities in the UK. It is generally a safe place to come and live and study but crime does happen, just as in all parts of the country, so you need to make sure that you reduce the risk of becoming a victim.
These pages have information on keeping safe and also looking out for others in the community.
You may also want to look at the Safer York Partnership website. The Safer York Partnership operates to reduce the number of crimes committed to make York a safer place to visit and live.