Time Machine can be configured to exclude folders from your backups (see System Settings > General > Time Machine > Options). I usually exclude these:
- /Library/Caches
- ~/Library/Caches
- ~/Library/Developer/CoreSimulator
- ~/Library/Developer/XCPGDevices
- ~/Library/Developer/XCTestDevices
- ~/Library/Developer/Xcode/DerivedData
- ~/Library/Developer/Xcode/DocumentationCache
- ~/Library/Developer/Xcode/iOS DeviceSupport
- ~/Library/Developer/Xcode/tvOS DeviceSupport
- ~/Library/Developer/Xcode/watchOS DeviceSupport
- ~/Library/Logs/CoreSimulator
Also, if you need to make space to be able to install Xcode or a macOS update, you can delete the contents of the above folders (assuming you no longer need old device SDKs).