Relatively new to serverless myself but I am pretty sure this is how it works.
You define your resources in the yaml file (eg a DynamoDB table) and then the first time you deploy the yaml, it will create the table (or any resource).
Any subsequent deploys will first check if there are any changes to the resource and will then apply those changes if required. If nothing has changed in that resource, then the deploy will do nothing to that resource.
For example, you create a YAML with a dynamo DB table and an single API gateway and associated lambda function. All 3 will be created when you deploy.
If you then add a new API gateway and lambda to the yaml and deploy, only the new API gateway and lambda will be deployed, the rest will be ignored as it hasn’t changed.