Not a very good coder, having trouble printing a Serial variable to an I2C LCD.

I am trying to print a Serial variable to the LCD, however all the shows is 4 lines in one character space when I use “lcd.print((char)str);” and the number 10 when is use just “lcd.print(str);”
I added a delay after both if statements and the lcd prints all the charcters one by one before showing the 4 lines.

#include <hd44780.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F, 16, 2);

void setup() {
  Serial.begin(9600);
  lcd.begin(16,2);
  lcd.backlight();
  lcd.init();
  lcd.clear();
}

void loop() {
  if(Serial.available()){
    int reader = Serial.read();
    if (reader){
      Serial.write((char)reader);
      byte str = reader;
      lcd.clear();
      lcd.setCursor(0,0);
      lcd.print("  Distance:");
      lcd.setCursor(0,1);
      lcd.print("  ");
      lcd.setCursor(2,1);
      lcd.print((char)str);
      lcd.setCursor(8,1);
      lcd.print(" mm");
    }
  }
}

Try this. I modified your code a bit. Look for comments that point you to more information on the functions used. You had bits of 3 different libraries for the display. I set it up to use the hd44780 library. The hd44780 library is available via the library manager and should be installed that way.

#include <Wire.h>
#include <hd44780.h>                       // main hd44780 header
#include <hd44780ioClass/hd44780_I2Cexp.h> // i2c expander i/o class header

hd44780_I2Cexp lcd; // declare lcd object: auto locate & auto config expander chip

void setup()
{
   Serial.begin(9600);
   Serial.println("arduino lives");
   lcd.begin(16, 2);
   lcd.print("arduino lives");
   delay(2000);
   lcd.backlight();
   lcd.clear();
}

void loop()
{
   if (Serial.available())
   {
      int reader = Serial.parseInt(); //https://www.arduino.cc/reference/en/language/functions/communication/serial/parseint
      if (reader)
      {
         Serial.print(reader);
         char str[8];  // buffer 
         // change int reader to string str
         itoa(reader, str, 10);  //http://www.cplusplus.com/reference/cstdlib/itoa/?kw=itoa
         lcd.setCursor(0, 0);
         lcd.print("  Distance:");
         lcd.setCursor(0, 1);
         lcd.print("        "); // overwrite old data with spaces
         lcd.setCursor(2, 1);
         lcd.print(str);
         lcd.setCursor(8, 1);
         lcd.print(" mm");
      }
   }
}

Look at the serial input basics tutorial to see better ways to handle serial input.

daniel_dim_15:
I am trying to print a Serial variable to the LCD, however all the shows is 4 lines in one character space when I use "lcd.print((char)str);" and the number 10 when is use just "lcd.print(str);"

You are trying to print the newline (or linefeed) character, which is the ASCII character with a decimal value of 10.