I have a few months old bike with SRAM Rival 1x. I have changed the cassette (to get closer gear spacing) and chain and can get the rear derailleur to shift almost perfectly swift and accurate both ways - apart from around the middle cog and onto the next one or two larger cogs. Here the shifting often can be, but not always is, hesitant or even not working, making the chain rub in-between cogs.
I have sized the chain by the standard procedure: Around largest cog and around the chainring bypassing the rear derailleur and then adding three inner and three outer links plus the powerlink, that is, a few links more than the four links recommmended by SRAM.
Since the bike is quite new and hasn't been out in mud or heavy rain, that is, the issue would not be lack of cleaning.
What could cause these problems with shifting at that particular point on the cassette?