You can't tell if a cassette is worn too far by looking/inspection. You can get 'chaincheckers' which indicate that your chain is elongated beyond a certain percentage (eg 0.75%). If that shows, change the chain asap (but do not throw the old chain away). You may have caught wear on the cassette early enough for a new chain to work on the old cassette.
If, going out for a quick test, when you put some power on, the chain starts skating (will likely happen on only one sprocket at first so try a bit of power on a range of sprockets) then put the old chain back on and ride on, till 1000s of miles down the road it skates. Then change both chain and cassette at the same time.
If, with the new chain on, you put some power on and all is good (ie the chain doesn't skate on any sprocket), you have caught wear on the cassette early enough for a new chain to work on the old cassette. Happy days - ride on, till 1000s of miles down the road it skates. Then change both chain and cassette at the same time.
Some riders manage to get their cassette to work with 3 (even 4) chains before needing to change the cassette. This relies on recording distance ridden and knowing how long (distance) the chain will do before elongating too much, and replacing the chain before significant elongation. The economics of trying to run several chains with one cassette depend on the cost of the cassette and chains (so 11sp and/or high end cassette may make that protocol worth it). Many just replace both when skating occurs and let them both wear together in harmony.