Where to place the code that needs to be a player and AI

I have a system with armor, resist and Health.
Where do I place the code if it must be in the PlayerController and AIController too?
And it wouldn’t be duplicated.

It should go in the Character/Pawn. Here’s a good overview: Gameplay Framework Quick Reference | Unreal Engine Documentation

A nice clean system would be having the controllers just translate Input (buttons or Behavior Trees) into action on the Character. And player specific things like score or player name (not necessarily character name) are in PlayerState.

I concur with Smilingrob,

You could also make a Master Controller and/or Character/Pawn class that the individual classes inherit from. The Master class can contain all of the variables / functions that should be similar between all children of that class, and the children can be more specific.