Provider version and terraform version queries

When AWS provider version set to 3.7 and later when code is changed how come terraform code uses later version of provider? and how it avoids breaking the code when we fix the provider version?

so we always need to fix the provider version to avoid braking the code?