Do you have a multi-subnet failover AG or a distributed AG? SQL Server and WSFC can take care of updating DNS automatically during failovers.
In the case of a multi-subnet AG (which supports automatic failover when replica is synchronous), both listener IP addresses are automatically registered in DNS if the RegisterAllProvidersIP property is set to1 (the default). No DNS changes during failovers are needed since both IP addresses are registered. Clients also need to specify MultiSubnetFailover=true in the connection string to avoid connection latency.
If RegisterAllProvidersIP=0, then only the active primary listener IP address is registered in DNS. WSFC will automatically update DNS to the IP address to the active primary node during failover. This is needed if you have legacy client drivers that don't support the MultiSubnetFailover connection string keyword.