Backend S3 for multiple AWS accounts

I have 2 different AWS accounts and I want that each one stores the .tfstate on their S3 bucket.
I’m using the terraform workspace to swap between infrastructures, but for the backend config, I can’t use terraform variables. Basically:

terraform {
  required_version = ">= 1.5.7"

  backend "s3" {
    bucket = "${var.prefix}-${terraform.workspace}-terraform-state"
    key    = "terraform.tfstate"
    region = "eu-west-1"

  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 5.17.0"

I read the documentation, but I don’t find anything that helps me. From what I understand, I need a 3rd AWS account that manages these terraform states?

I also get the credentials error, but I’m guessing that’s because I need to pass the profile config