Accurate segmentation of brain tumors is vital for effective treatment planning, disease diagnosis, and monitoring treatment outcomes. Post-surgical monitoring, particularly for recurring tumors, relies on MRI scans, presenting challenges in segmenting small residual tumors due to surgical artifacts. This emphasizes the need for a robust model with superior feature extraction capabilities for precise segmentation in both pre- and post-operative scenarios. The study introduces the Hybrid Attention-Residual UNET with Transformer Blocks (HART-UNet), enhancing the U-Net architecture with a spatial self-attention module, deep residual connections, and RESNET50 weights. Trained on BRATS’20 and validated on Kaggle LGG and BTC_ postop datasets, HART-UNet outperforms established models (UNET, Attention UNET, UNET++, and RESNET 50), achieving Dice Coefficients of 0.96, 0.97, and 0.88, respectively. These results underscore the model’s superior segmentation performance, marking a significant advancement in brain tumor analysis across pre- and post-operative MRI scans.