Tile ID is not static

Yes, the “firstgid” generally only exists in the map file and not in memory. It is only used to assign global IDs to all tiles so that tile layers and objects can refer to the tiles by simple numbers rather than tileset + local id pairs.

So in your game you should generally not use the global ID to associate other information with the tile or to refer to a specific tile. Instead, use the local ID (highlighted in your screenshot) and the tileset if needed to refer a specific tile.

Sometimes you can also use custom properties to set up this data. For example, if your building tiles have a custom property “BuildingID”, then this provides a quick way to know the building given a tile, and upon loading a tileset you can easily set up a reverse mapping from BuildingID to tile if needed.