sometime they align, but school districts are basically just the grouping of certain schools that all fall under one umbrella. They can be across county lines.
For example the school district I grew up in used to be basically the entire county, but while I was there the schools from my town decided to split off and create a separate district with its own rules (which ended up being a good thing)