^ matches at the start of the input and $ at the end. Neither consumes a character; they are assertions about a position, which is why you cannot repeat one.
A pattern without them can match anywhere inside the input. That is exactly what you want when you are searching, and exactly what you do not want when you are validating.
Anchoring is also the cheapest thing you can do to a pattern. Without ^, the engine has to try the whole pattern again at every position in the input; with it, there is one position to try.
Watch the step count on those two patterns. The anchored one does not just answer differently, it answers in a fraction of the work.
$ matches at the end of the input, and — unlike some other languages — it does not forgive a trailing newline. A line read from a file with its terminator still attached will fail a pattern that ends in $.