There are several types of year, some of which are affected by a change in the Earth’s rotation and some not, so this discussion is going to be confused unless everyone clarifies which “year” they are referring to. You are, I think, referring to the calendar year, defined as 365 days. It seems odd to think that the calendar year would remain 31,536,000 seconds if the length of the day changes since the definition is based on days. We currently add leap seconds occasionally and the year changes to adapt to them (that is, a year containing one leap second is one second longer than a year without leap seconds). A calendar year is always 365 days, so changes duration as the day changes and the number of days in the year doesn’t change.
There is also the sidereal year, the time that the Earth takes to complete one orbit with respect to the stars, which is about 31,558,150 seconds. This doesn’t change if the day changes, so the number of days in a sidereal year (currently about 365.2564) changes if the length of the day changes.
There is the anomalistic year, the time it takes for the Earth to move from one perihelion to the next. This is about 31,558,433 seconds and would not be changed by a change in the Earth’s rotation, so again the number of days in the anomalistic year would change.
There is the tropical year, the time it takes for the Sun to move from one vernal equinox to the next. This is the year based on the Earth’s seasons, and is about 31,556,925 seconds, 20 minutes shorter than the sidereal year because of the 26,000 year cycle of the precession of the Earth’s axis. This wouldn’t change if the day changes, so the number of days per tropical year would change.
There is the Julian year, used by astronmers, defined as 31,557,600 seconds (365.25 days). Presumably that definition wouldn’t change if the day changes since it’s already disassociated from the length of day.
There are even more year definitions but these are the most common ones.