Finding rise time and amplitude

could be - one has to be careful what one calls in interrupt routines (depends on target processor)

try setting a flag in the interrupt routine and reading the ADC in loop()

#define PB0 16
volatile int pwm_value = 0;
volatile int prev_time = 0;
volatile float voltage=0.0;
volatile bool highLevel=false;

void setup() {
  Serial.begin(115200);
  analogReadResolution(12);

  // when pin D2 goes high, call the rising function
  attachInterrupt(PB0, rising, RISING);
}

void loop() {
  if(highLevel) {
    highLevel=false;
    voltage= analogRead(34) * 3.3/4096;  // read the input pin
  }
  if (pwm_value > 0) {
    Serial.println(pwm_value);
    Serial.printf("voltage %f\n", voltage);
    delay(1000);
  }
}

void rising() {
  attachInterrupt(PB0, falling, FALLING);
  prev_time = micros();
  highLevel=true;
  //voltage= analogRead(34) * 3.3/4096;  // read the input pin
}

void falling() {
  attachInterrupt(PB0, rising, RISING);
  pwm_value = micros() - prev_time;
  //Serial.println(pwm_value);
}

on ESP32 serial monitor displays

50002
voltage 2.505615
50002
voltage 2.524951