When someone experiences these thoughts they often feel quite upset
And they may feel worried and anxious.
Understandably, they want to make the anxiety go away and so they do something that makes them feel better.
For example, Sam could be thinking:
What if my dog has gone missing?!
This would make him feel very upset and anxious. The natural response might be for Sam to go and check on his dog.
When he sees the dog is still there, he would feel very relieved.