Tasks are a more general concept; one of the many possible tasks you could program would be to build your project.
Other possible tasks including initializing the database (for a new developer), regenerating some artificat that isn’t normally regenerated during the build, and launching a local web server running the project.